Пример #1
0
 /**
  * @param IInput $input
  * @param IConsole $console
  *
  * @return ICommand
  * @throws AmbiguousCommandException
  * @throws CommandNotFoundException
  */
 protected function findCommand(IInput $input, IConsole $console)
 {
     if ($input->hasArgument('command')) {
         $matcher = new ArgumentsMatcher(new ArgumentsParser());
         return $matcher->findCommand($console->getCommands(), $input->getArgument('command'));
     }
     return $input->getCommand();
 }
Пример #2
0
 /**
  * @param $string
  * @param bool $strict
  *
  * @return array
  * @throws Exceptions\TooManyArgumentValuesException
  */
 public function parseString($string, $strict = true)
 {
     $parser = new ArgumentsParser();
     $matcher = new ArgumentsMatcher($parser);
     $args = $parser->parse($string);
     $args = $parser->group($args);
     return $matcher->matchCommand($this, $args, $strict);
 }