Commando\Command::getOption PHP Method

getOption() public method

public getOption ( string $option ) : Option
$option string
return Option
    public function getOption($option)
    {
        if (!$this->hasOption($option)) {
            throw new \Exception(sprintf('Unknown option, %s, specified', $option));
        }
        return $this->options[$option];
    }

Usage Example

 public function testRetrievingOptionAnon()
 {
     // Annonymous
     $tokens = array('filename', 'arg1', 'arg2', 'arg3');
     $cmd = new Command($tokens);
     $option = $cmd->option()->require();
     $this->assertTrue($cmd->getOption(0)->isRequired());
     $cmd->option(0)->require(false);
     $this->assertFalse($cmd->getOption(0)->isRequired());
     $this->assertEquals(1, $cmd->getSize());
 }