parse() public method

The Generator yields any parsing errors. Parsing will stop when all arguments are processed or the first option flagged Cli\Args::HALT was encountered.
public parse ( integer $argc, array $argv ) : Generator
$argc integer
$argv array
return Generator
Beispiel #1
0
 public function testValidate()
 {
     $this->args->compile([["r", "required-option", "This option is required", CliArgs::REQUIRED | CliArgs::NOARG]]);
     foreach ($this->args->parse(0, []) as $error) {
         throw new \Exception("Unexpected parse error: {$error}");
     }
     foreach ($this->args->validate() as $error) {
         $this->assertStringMatchesFormat("%srequired-option%srequired", $error);
     }
     $this->assertTrue(isset($error));
 }