예제 #1
0
 /**
  * @param $args
  * @return array
  */
 private function checkArgs($args)
 {
     unset($args[0]);
     $arguments = [];
     array_walk($args, function ($a) use(&$arguments) {
         $value = null;
         $name = $a;
         if (strpos($a, '=')) {
             list($name, $value) = explode('=', $a, 2);
         }
         switch ($name) {
             case '--env':
                 $this->env = $value;
                 $this->config->setEnv($this->env);
                 break;
             case 'create':
                 $this->createFromTemplate = true;
                 break;
             case '--comment':
                 if (true === empty($value)) {
                     throw new InvalidArgumentException(sprintf('Undefined attribute `%s` value', $name));
                 }
                 $arguments['comment'] = $value;
                 break;
             default:
                 throw new InvalidArgumentException(sprintf('Unknow attribute %s`', $name));
         }
     });
     return $arguments;
 }