| @@ 7-33 (lines=27) @@ | ||
| 4 | ||
| 5 | use RMiller\BehatSpec\Extension\PhpSpecExtension\Process\CachingExecutableFinder; |
|
| 6 | ||
| 7 | class CliFunctionChecker |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var \RMiller\BehatSpec\Extension\PhpSpecExtension\Process\CachingExecutableFinder |
|
| 11 | */ |
|
| 12 | private $executableFinder; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * @param \RMiller\BehatSpec\Extension\PhpSpecExtension\Process\CachingExecutableFinder $executableFinder |
|
| 16 | */ |
|
| 17 | public function __construct(CachingExecutableFinder $executableFinder) |
|
| 18 | { |
|
| 19 | $this->executableFinder = $executableFinder; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param string $function |
|
| 24 | * |
|
| 25 | * @return bool |
|
| 26 | */ |
|
| 27 | public function functionCanBeUsed($function) |
|
| 28 | { |
|
| 29 | return (php_sapi_name() == 'cli') |
|
| 30 | && $this->executableFinder->getExecutablePath() |
|
| 31 | && function_exists($function); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| @@ 7-33 (lines=27) @@ | ||
| 4 | ||
| 5 | use RMiller\BehatSpec\Extension\PhpSpecRunExtension\Process\CachingExecutableFinder; |
|
| 6 | ||
| 7 | class CliFunctionChecker |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var \RMiller\BehatSpec\Extension\PhpSpecRunExtension\Process\CachingExecutableFinder |
|
| 11 | */ |
|
| 12 | private $executableFinder; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * @param \RMiller\BehatSpec\Extension\PhpSpecRunExtension\Process\CachingExecutableFinder $executableFinder |
|
| 16 | */ |
|
| 17 | public function __construct(CachingExecutableFinder $executableFinder) |
|
| 18 | { |
|
| 19 | $this->executableFinder = $executableFinder; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param string $function |
|
| 24 | * |
|
| 25 | * @return bool |
|
| 26 | */ |
|
| 27 | public function functionCanBeUsed($function) |
|
| 28 | { |
|
| 29 | return (php_sapi_name() == 'cli') |
|
| 30 | && $this->executableFinder->getExecutablePath() |
|
| 31 | && function_exists($function); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||