class PreflightArgs extends Config implements PreflightArgsInterface (View source)

Storage for arguments preprocessed during preflight.

Holds @sitealias, if present, and a limited number of global options.

TODO: The methods here with >~3 lines of logic could be refactored into a couple of different classes e.g. a helper to convert preflight args to configuration, and another to prepare the input object.

Constants

DRUSH_CONFIG_PATH_NAMESPACE

DRUSH_RUNTIME_CONTEXT_NAMESPACE

ALIAS

ALIAS_PATH

COMMAND_PATH

CONFIG_PATH

COVERAGE_FILE

LOCAL

ROOT

URI

SIMULATE

STRICT

DEBUG

Properties

protected array $args
protected string $homeDir
protected $commandName

Methods

string
homeDir()

No description

void
setHomeDir(string $homeDir)

No description

__construct(array $data = [])

PreflightArgs constructor

array
optionsWithValues()

No description

void
adjustHelpOption()

If the user enters '--help' or '-h', thrown that option away and add a 'help' command to the beginning of the argument list.

array
optionConfigMap()

Map of option key to the corresponding config key to store the preflight option in. The values of the config items in this map must be BOOLEANS or STRINGS.

array
optionConfigPathMap()

Map of path option keys to the corresponding config key to store the preflight option in. The values of the items in this map must be STRINGS or ARRAYS OF STRINGS.

applyToConfig(ConfigInterface $config)

No description

args()

No description

applicationPath()

No description

commandName()

No description

setCommandName($commandName)

No description

addArg(string $arg)

No description

passArgs($args)

No description

alias()

No description

hasAlias()

No description

setAlias(string $alias)

No description

selectedSite($default = false)

Get the selected site. Here, the default will typically be the cwd.

void
setDebug($value)

No description

setSelectedSite($root)

Set the selected site.

uri($default = false)

Get the selected uri

bool
hasUri()

No description

setUri($uri)

Set the uri option

configPaths()

Get the config path where drush.yml files may be found

addConfigPath(string $path)

Add another location where drush.yml files may be found

mergeConfigPaths(array $configPaths)

Add multiple additional locations where drush.yml files may be found.

aliasPaths()

Get the alias paths where drush site.site.yml files may be found

addAliasPath(string $path)

Set one more path where aliases may be found.

commandPaths()

Get the path where Drush commandfiles e.g. FooCommands.php may be found.

addCommandPath(string $path)

Add one more path where commandfiles might be found.

mergeCommandPaths($commandPaths)

Add multiple paths where commandfiles might be found.

isLocal()

Determine whether Drush is in "local" mode

setLocal(bool $isLocal)

Set local mode

isSimulated()

Determine whether Drush is in "simulated" mode.

setSimulate($simulate)

Set simulated mode

coverageFile()

Get the path to the coverage file.

setCoverageFile($coverageFile)

Set the coverage file path.

isStrict()

Determine whether Drush is in "strict" mode or not.

setStrict(bool $strict)

Set strict mode.

array
getOptionNameList(array $argv)

Search through the provided argv list, and return just the option name of any item that is an option.

InputInterface
createInput()

Create a Symfony Input object.

Details

string homeDir()

No description

Return Value

string

void setHomeDir(string $homeDir)

No description

Parameters

string $homeDir

Return Value

void

__construct(array $data = [])

PreflightArgs constructor

Parameters

array $data

Initial data (not usually used)

array optionsWithValues()

No description

Return Value

array

void adjustHelpOption()

If the user enters '--help' or '-h', thrown that option away and add a 'help' command to the beginning of the argument list.

Return Value

void

protected array optionConfigMap()

Map of option key to the corresponding config key to store the preflight option in. The values of the config items in this map must be BOOLEANS or STRINGS.

Return Value

array

protected array optionConfigPathMap()

Map of path option keys to the corresponding config key to store the preflight option in. The values of the items in this map must be STRINGS or ARRAYS OF STRINGS.

Return Value

array

applyToConfig(ConfigInterface $config)

No description

Parameters

ConfigInterface $config

The configuration object to inject data into

See also

Environment::exportConfigData()
which also exports information to config.

args()

No description

applicationPath()

No description

commandName()

No description

setCommandName($commandName)

No description

Parameters

$commandName

addArg(string $arg)

No description

Parameters

string $arg

One argument

passArgs($args)

No description

Parameters

$args

alias()

No description

hasAlias()

No description

setAlias(string $alias)

No description

Parameters

string $alias

The alias name '@site'

selectedSite($default = false)

Get the selected site. Here, the default will typically be the cwd.

Parameters

$default

void setDebug($value)

No description

Parameters

$value

Return Value

void

PreflightArgs setSelectedSite($root)

Set the selected site.

Parameters

$root

Return Value

PreflightArgs

uri($default = false)

Get the selected uri

Parameters

$default

bool hasUri()

No description

Return Value

bool

PreflightArgs setUri($uri)

Set the uri option

Parameters

$uri

Return Value

PreflightArgs

configPaths()

Get the config path where drush.yml files may be found

PreflightArgs addConfigPath(string $path)

Add another location where drush.yml files may be found

Parameters

string $path

Return Value

PreflightArgs

PreflightArgs mergeConfigPaths(array $configPaths)

Add multiple additional locations where drush.yml files may be found.

Parameters

array $configPaths

Return Value

PreflightArgs

aliasPaths()

Get the alias paths where drush site.site.yml files may be found

PreflightArgs addAliasPath(string $path)

Set one more path where aliases may be found.

Parameters

string $path

Return Value

PreflightArgs

commandPaths()

Get the path where Drush commandfiles e.g. FooCommands.php may be found.

PreflightArgs addCommandPath(string $path)

Add one more path where commandfiles might be found.

Parameters

string $path

Return Value

PreflightArgs

PreflightArgs mergeCommandPaths($commandPaths)

Add multiple paths where commandfiles might be found.

Parameters

$commandPaths

Return Value

PreflightArgs

isLocal()

Determine whether Drush is in "local" mode

PreflightArgs setLocal(bool $isLocal)

Set local mode

Parameters

bool $isLocal

Return Value

PreflightArgs

isSimulated()

Determine whether Drush is in "simulated" mode.

PreflightArgs setSimulate($simulate)

Set simulated mode

Parameters

$simulate

Return Value

PreflightArgs

coverageFile()

Get the path to the coverage file.

PreflightArgs setCoverageFile($coverageFile)

Set the coverage file path.

Parameters

$coverageFile

Return Value

PreflightArgs

isStrict()

Determine whether Drush is in "strict" mode or not.

PreflightArgs setStrict(bool $strict)

Set strict mode.

Parameters

bool $strict

Return Value

PreflightArgs

protected array getOptionNameList(array $argv)

Search through the provided argv list, and return just the option name of any item that is an option.

Parameters

array $argv

e.g. ['foo', '--bar=baz', 'boz']

Return Value

array

e.g. ['bar']

InputInterface createInput()

Create a Symfony Input object.

Return Value

InputInterface