ExecutableFinderTrait.php in Tome 8
File
modules/tome_base/src/ExecutableFinderTrait.php
View source
<?php
namespace Drupal\tome_base;
use Symfony\Component\Console\Input\InputInterface;
trait ExecutableFinderTrait {
protected function findExecutable(InputInterface $input) {
$args = [];
foreach ($_SERVER['argv'] as $arg) {
if ($arg === $input
->getFirstArgument()) {
break;
}
if (strpos($arg, '--backend') !== 0) {
$args[] = $arg;
}
}
if (isset($_SERVER['PWD']) && !is_file($args[0]) && is_file($_SERVER['PWD'] . '/' . $args[0])) {
$args[0] = $_SERVER['PWD'] . '/' . $args[0];
}
return implode(' ', $args);
}
}