Webmozart\Console\Api\Args\Format\ArgsFormatBuilder::getCommandOptions PHP Method

getCommandOptions() public method

Returns all command options added to the builder.
public getCommandOptions ( boolean $includeBase = true ) : CommandOption[]
$includeBase boolean Whether to include command options of the base format in the result.
return CommandOption[] The command options.
    public function getCommandOptions($includeBase = true)
    {
        Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
        $commandOptions = array_values($this->commandOptions);
        if ($includeBase && $this->baseFormat) {
            // prepend base command options
            $commandOptions = array_merge($this->baseFormat->getCommandOptions(), $commandOptions);
        }
        return $commandOptions;
    }

Usage Example

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testGetCommandOptionsFailsIfIncludeBaseNoBoolean()
 {
     $this->builder->getCommandOptions(1234);
 }