GetOptionKit\Argument::getOptionName PHP Method

getOptionName() public method

Parse option and return the name after dash. e.g., '--foo' returns 'foo' '-f' returns 'f'.
public getOptionName ( ) : string
return string
    public function getOptionName()
    {
        if (preg_match('/^[-]+([a-zA-Z0-9-]+)/', $this->arg, $regs)) {
            return $regs[1];
        }
    }

Usage Example

Example #1
0
 function test2()
 {
     $arg = new Argument('--option=value');
     ok($arg->containsOptionValue());
     is('value', $arg->getOptionValue());
     is('option', $arg->getOptionName());
 }
All Usage Examples Of GetOptionKit\Argument::getOptionName