Provides a superclass for commands
Inheritance: implements Zephir\Commands\CommandInterface
コード例 #1
0
 public function execute(Config $config, Logger $logger)
 {
     if (isset($_SERVER['argv'][2])) {
         $this->setParameter('namespace', strtolower(preg_replace('/[^0-9a-zA-Z]/', '', $_SERVER['argv'][2])));
     }
     parent::execute($config, $logger);
 }
コード例 #2
0
ファイル: CommandApi.php プロジェクト: KomaBeyond/zephir
 public function execute(Config $config, Logger $logger)
 {
     $params = $this->parseArguments();
     $allowedArgs = array("theme-path" => "@.+@");
     foreach ($params as $k => $p) {
         if (isset($allowedArgs[$k])) {
             if (preg_match($allowedArgs[$k], $p)) {
                 $this->setParameter($k, $p);
             } else {
                 throw new Exception("Invalid value for argument '{$k}'");
             }
         } else {
             throw new Exception("Invalid argument '{$k}''");
         }
     }
     parent::execute($config, $logger);
 }
コード例 #3
0
ファイル: CommandApi.php プロジェクト: gvanbeck/zephir
 public function execute(Config $config, Logger $logger)
 {
     $params = $this->parseArguments();
     $allowedArgs = array("theme-path" => "@.+@", "output-directory" => "@.+@", "theme-options" => "@.+@", "base-url" => "@.+@");
     foreach ($params as $k => $p) {
         if (isset($allowedArgs[$k])) {
             if (preg_match($allowedArgs[$k], $p)) {
                 $this->setParameter($k, $p);
             } else {
                 throw new Exception("Invalid value for argument '{$k}'");
             }
         } else {
             if (!in_array($k, array('parser-compiled'))) {
                 throw new Exception("Invalid argument '{$k}' for api command'");
             }
         }
     }
     parent::execute($config, $logger);
 }