commandExists() публичный Метод

Check whether a shell command exists.
public commandExists ( string $command ) : boolean
$command string
Результат boolean
Пример #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;
 }
Пример #2
0
 /**
  * @throws DependencyMissingException
  */
 public function ensureInstalled()
 {
     static $installed;
     if (empty($installed) && $this->getDrushExecutable() === 'drush' && !$this->shellHelper->commandExists('drush')) {
         throw new DependencyMissingException('Drush is not installed');
     }
     $installed = true;
 }
Пример #3
0
 /**
  * @return string
  */
 protected function getTarExecutable()
 {
     $candidates = ['tar', 'tar.exe', 'bsdtar.exe'];
     foreach ($candidates as $command) {
         if ($this->shellHelper->commandExists($command)) {
             return $command;
         }
     }
     throw new \RuntimeException("Tar command not found");
 }
Пример #4
0
 /**
  * Ensure that the Git CLI is installed.
  *
  * @throws DependencyMissingException
  */
 public function ensureInstalled()
 {
     if (!$this->shellHelper->commandExists('git')) {
         throw new DependencyMissingException('Git must be installed');
     }
 }