Platformsh\Cli\Helper\ShellHelperInterface::commandExists PHP Method

commandExists() public method

Check whether a shell command exists.
public commandExists ( string $command ) : boolean
$command string
return boolean
    public function commandExists($command);

Usage Example

Exemplo n.º 1
0
 /**
  * @throws DependencyMissingException
  *
  * @return string|false
  */
 public function getVersion()
 {
     static $version;
     if (!$version) {
         if (!$this->shellHelper->commandExists('git')) {
             throw new DependencyMissingException('Git must be installed');
         }
         $version = false;
         $string = $this->execute(['--version'], false);
         if ($string && preg_match('/(^| )([0-9]+[^ ]*)/', $string, $matches)) {
             $version = $matches[2];
         }
     }
     return $version;
 }
All Usage Examples Of Platformsh\Cli\Helper\ShellHelperInterface::commandExists