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); }
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); }
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); }