aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs')
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs70
1 files changed, 0 insertions, 70 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs b/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs
deleted file mode 100644
index e8661866..00000000
--- a/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-//! ref: composer/vendor/symfony/process/PhpExecutableFinder.php
-
-use super::executable_finder::ExecutableFinder;
-
-#[derive(Debug)]
-pub struct PhpExecutableFinder {
- executable_finder: ExecutableFinder,
-}
-
-impl Default for PhpExecutableFinder {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl PhpExecutableFinder {
- pub fn new() -> Self {
- Self {
- executable_finder: ExecutableFinder::new(),
- }
- }
-
- /// Finds The PHP executable.
- pub fn find(&self, _include_args: bool) -> Option<String> {
- if let Some(php) = shirabe_php_shim::getenv("PHP_BINARY").filter(|v| !v.is_empty()) {
- let mut php = php.to_string_lossy().into_owned();
- if !shirabe_php_shim::is_executable(&php) {
- match self.executable_finder.find(&php, None, &[]) {
- Some(found) => php = found,
- None => return None,
- }
- }
-
- if shirabe_php_shim::is_dir(&php) {
- return None;
- }
-
- return Some(php);
- }
-
- // The original `\PHP_BINARY && \PHP_SAPI` branch describes the running PHP interpreter.
- // These constants cannot be obtained in Rust, the branch is skipped here.
-
- if let Some(php) = shirabe_php_shim::getenv("PHP_PATH").filter(|v| !v.is_empty()) {
- let php = php.to_string_lossy().into_owned();
- if !shirabe_php_shim::is_executable(&php) || shirabe_php_shim::is_dir(&php) {
- return None;
- }
-
- return Some(php);
- }
-
- if let Some(php) = shirabe_php_shim::getenv("PHP_PEAR_PHP_BIN").filter(|v| !v.is_empty()) {
- let php = php.to_string_lossy().into_owned();
- if shirabe_php_shim::is_executable(&php) && !shirabe_php_shim::is_dir(&php) {
- return Some(php);
- }
- }
-
- // Even if `\PHP_BINDIR` is unavailable, searching `$PATH` should be performed.
- self.executable_finder.find("php", None, &[])
- }
-
- /// Finds the PHP executable arguments.
- pub fn find_arguments(&self) -> Vec<String> {
- // If PHP_SAPI is not "phpdbg", returns an empty array. In Rust, PHP_SAPI is always "cli",
- // so always returns an empty array.
- vec![]
- }
-}