public function getOptionParser()
    {
        list($root, $name) = explode(' ', $this->name, 2);
        $parser = new ConsoleOptionParser($name);
        $parser->setRootName($root);

        $parser = $this->buildOptionParser($parser);
        if (!($parser instanceof ConsoleOptionParser)) {
            throw new RuntimeException(sprintf(
                "Invalid option parser returned from buildOptionParser(). Expected %s, got %s",
                ConsoleOptionParser::class,
                getTypeName($parser)
            ));
        }

        return $parser;
    }
public function getOptionParser()
    {
        list($root, $name) = explode(' ', $this->name, 2);
        $parser = new ConsoleOptionParser($name);
        $parser->setRootName($root);

        $parser = $this->buildOptionParser($parser);
        if (!($parser instanceof ConsoleOptionParser)) {
            throw new RuntimeException(sprintf(
                "Invalid option parser returned from buildOptionParser(). Expected %s, got %s",
                ConsoleOptionParser::class,
                getTypeName($parser)
            ));
        }

        return $parser;
    }
public function getOptionParser ( ) { list ( $ root , $ name ) = explode ( ' ' , $ this -> name , 2 ) ; $ parser = new ConsoleOptionParser ( $ name ) ; $ parser -> setRootName ( $ root ) ; $ parser = $ this -> buildOptionParser ( $ parser ) ; if ( ! ( $ parser instanceof ConsoleOptionParser ) ) { throw new RuntimeException ( sprintf ( "Invalid option parser returned from buildOptionParser(). Expected %s, got %s" , ConsoleOptionParser :: class , getTypeName ( $ parser ) ) ) ; } return $ parser ; }
Get the option parser.

You can override buildOptionParser() to define your options & arguments.

@return \Cake\Console\ConsoleOptionParser
@throws \RuntimeException When the parser is invalid
Get the option parser .