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

void
setArgsRemapper(ArgsRemapper $remapper)

No description

parse(array $argv, PreflightArgsInterface $storage)

Parse the argv array.

static bool
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.

array
findMethodForOptionWithValues(array $optionsTable, string $opt)

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

array
checkMatchingOption(string $opt, string $keyParam, string $methodName)

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

Details

__construct()

ArgsPreprocessor constructor

void setArgsRemapper(ArgsRemapper $remapper)

No description

Parameters

ArgsRemapper $remapper

Return Value

void

parse(array $argv, PreflightArgsInterface $storage)

Parse the argv array.

Parameters

array $argv

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

PreflightArgsInterface $storage

static protected bool nextCouldBeValue($argv)

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

Parameters

$argv

Return Value

bool

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 array findMethodForOptionWithValues(array $optionsTable, string $opt)

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

Parameters

array $optionsTable

Table of option names and the name of the method that should be called to process that option.

string $opt

The option string to check

Return Value

array

protected array checkMatchingOption(string $opt, string $keyParam, string $methodName)

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

Parameters

string $opt

The option string to check

string $keyParam
string $methodName

Return Value

array