示例#1
0
 /**
  * Parses the raw console arguments and returns the parsed arguments.
  *
  * @param RawArgs $args    The raw console arguments.
  * @param bool    $lenient Whether the parser should ignore parse errors.
  *                         If `true`, the parser will not throw any
  *                         exceptions when parse errors occur.
  *
  * @return Args The parsed console arguments.
  *
  * @throws CannotParseArgsException If the arguments cannot be parsed.
  */
 public function parseArgs(RawArgs $args, $lenient = null)
 {
     if (null === $lenient) {
         $lenient = $this->config->isLenientArgsParsingEnabled();
     }
     return $this->config->getArgsParser()->parseArgs($args, $this->argsFormat, $lenient);
 }
示例#2
0
 public function testGetArgsParserReturnsApplicationArgsParserByDefault()
 {
     $parser = new DefaultArgsParser();
     $this->applicationConfig->setArgsParser($parser);
     $this->assertSame($parser, $this->config->getArgsParser());
 }