class ArgsPreprocessor (View source)

Preprocess commandline arguments.

  • Record @sitealias, if present
  • Record a limited number of global options

Anything not handled here is processed by Symfony Console.

Properties

protected SiteSpecParser $specParser
protected ArgsRemapper $remapper

Methods

__construct()

ArgsPreprocessor constructor

setArgsRemapper(ArgsRemapper $remapper)

No description

parse(string[] $argv, PreflightArgsInterface $storage)

Parse the argv array.

static 
nextCouldBeValue($argv)

nextCouldBeValue determines whether there is a next argument that exists and does not begin with a -.

bool
isAliasOrSiteSpec(string $arg)

Determine whether the provided argument is an alias or a site specification.

[$methodName,
findMethodForOptionWithValues($optionsTable, $opt)

Check to see if '$opt' is one of the options that we record that takes a value.

[$methodName,
checkMatchingOption($opt, $keyParam, $methodName)

Check to see if the provided option matches the entry from the option table.

Details

__construct()

ArgsPreprocessor constructor

setArgsRemapper(ArgsRemapper $remapper)

Parameters

ArgsRemapper $remapper

parse(string[] $argv, PreflightArgsInterface $storage)

Parse the argv array.

Parameters

string[] $argv Commandline arguments. The first element is the path to the application, which we will ignore.
PreflightArgsInterface $storage A storage object to hold the arguments we remove from argv, plus the remaining argv arguments.

static protected nextCouldBeValue($argv)

nextCouldBeValue determines whether there is a next argument that exists and does not begin with a -.

Parameters

$argv

protected bool isAliasOrSiteSpec(string $arg)

Determine whether the provided argument is an alias or a site specification.

Parameters

string $arg Argument to test.

Return Value

bool

protected [$methodName, findMethodForOptionWithValues($optionsTable, $opt)

Check to see if '$opt' is one of the options that we record that takes a value.

Parameters

$optionsTable Table of option names and the name of the method that should be called to process that option.
$opt The option string to check

Return Value

[$methodName, $optionValue, $acceptsValueFromNextArg]

protected [$methodName, checkMatchingOption($opt, $keyParam, $methodName)

Check to see if the provided option matches the entry from the option table.

Parameters

$opt
$keyParam
$methodName

Return Value

[$methodName, $optionValue, $acceptsValueFromNextArg]