[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/drydock/interface/command/ -> DrydockCommandInterface.php (source)

   1  <?php
   2  
   3  abstract class DrydockCommandInterface extends DrydockInterface {
   4  
   5    private $workingDirectory;
   6  
   7    public function setWorkingDirectory($working_directory) {
   8      $this->workingDirectory = $working_directory;
   9      return $this;
  10    }
  11  
  12    public function getWorkingDirectory() {
  13      return $this->workingDirectory;
  14    }
  15  
  16    final public function getInterfaceType() {
  17      return 'command';
  18    }
  19  
  20    final public function exec($command) {
  21      $argv = func_get_args();
  22      $exec = call_user_func_array(
  23        array($this, 'getExecFuture'),
  24        $argv);
  25      return $exec->resolve();
  26    }
  27  
  28    final public function execx($command) {
  29      $argv = func_get_args();
  30      $exec = call_user_func_array(
  31        array($this, 'getExecFuture'),
  32        $argv);
  33      return $exec->resolvex();
  34    }
  35  
  36    abstract public function getExecFuture($command);
  37  
  38    protected function applyWorkingDirectoryToArgv(array $argv) {
  39      if ($this->getWorkingDirectory() !== null) {
  40        $cmd = $argv[0];
  41        $cmd = "(cd %s; {$cmd})";
  42        $argv = array_merge(
  43          array($cmd),
  44          array($this->getWorkingDirectory()),
  45          array_slice($argv, 1));
  46      }
  47  
  48      return $argv;
  49    }
  50  
  51  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1