ConfigForCommand
in package
implements
EventSubscriberInterface
This class is based on \Consolidation\Config\Inject\ConfigForCommand.
Will make sure that if an option is marked as array, it will be converted into an array.
Table of Contents
Interfaces
- EventSubscriberInterface
Properties
- $application : Application|null
- The application.
- $config : ConfigInterface
- The config.
Methods
- __construct() : mixed
- Construct new ConfigForCommand.
- getSubscribedEvents() : array<string, string|array{0: string, 1: int}|array<int, array{0: string, 1?: int}>>
- {@inheritdoc}
- injectConfiguration() : void
- Inject configurations.
- setApplication() : void
- Set application.
- fixInputForSymfony2() : void
- Fix arguments for help command.
- getHelpCommandTarget() : false|Command
- Get the help command.
- injectConfigGroupIntoOptions() : void
- Inject configurations for options.
- injectConfigurationForCommand() : void
- Inject configuration for command.
- injectConfigurationForGlobalOptions() : void
- Inject configurations for global options.
- explodeArray() : array<string|int, string>
- Explode a string to array.
- isArray() : bool
- Check whether the option is marked as VALUE_IS_ARRAY.
Properties
$application
The application.
protected
Application|null
$application
$config
The config.
protected
ConfigInterface
$config
Methods
__construct()
Construct new ConfigForCommand.
public
__construct(ConfigInterface $config) : mixed
Parameters
- $config : ConfigInterface
-
The configuration.
getSubscribedEvents()
{@inheritdoc}
public
static getSubscribedEvents() : array<string, string|array{0: string, 1: int}|array<int, array{0: string, 1?: int}>>
Return values
array<string, string|array{0: string, 1: int}|array<int, array{0: string, 1?: int}>> —The subscribed events.
injectConfiguration()
Inject configurations.
public
injectConfiguration(ConsoleCommandEvent $event) : void
Before a Console command runs, inject configuration settings for this command into the default value of the options of this command.
Parameters
- $event : ConsoleCommandEvent
-
The current event.
Return values
void —Configuration injected.
setApplication()
Set application.
public
setApplication(Application $application) : void
Parameters
- $application : Application
-
The application.
Return values
void —Set the application.
fixInputForSymfony2()
Fix arguments for help command.
protected
fixInputForSymfony2(Command $command, InputInterface $input) : void
Parameters
- $command : Command
-
The command.
- $input : InputInterface
-
The input.
Return values
void —The arguments for help command.
getHelpCommandTarget()
Get the help command.
protected
getHelpCommandTarget(Command $command, InputInterface $input) : false|Command
Parameters
- $command : Command
-
The command to get the help from.
- $input : InputInterface
-
The current input.
Return values
false|Command —The command.
injectConfigGroupIntoOptions()
Inject configurations for options.
protected
injectConfigGroupIntoOptions(ConfigGroup $configGroup, array<string|int, mixed> $options, InputInterface $input) : void
Parameters
- $configGroup : ConfigGroup
-
The current config group.
- $options : array<string|int, mixed>
-
The options.
- $input : InputInterface
-
The input.
Return values
void —Configuration options injected.
injectConfigurationForCommand()
Inject configuration for command.
protected
injectConfigurationForCommand(Command $command, InputInterface $input) : void
Parameters
- $command : Command
-
The command to configure.
- $input : InputInterface
-
The current input.
Return values
void —Configuration injected.
injectConfigurationForGlobalOptions()
Inject configurations for global options.
protected
injectConfigurationForGlobalOptions(InputInterface $input) : void
Parameters
- $input : InputInterface
-
The current input.
Return values
void —Configuration injected.
explodeArray()
Explode a string to array.
private
explodeArray(mixed $value) : array<string|int, string>
Parameters
- $value : mixed
-
The value to explode.
Return values
array<string|int, string> —The exploded values.
isArray()
Check whether the option is marked as VALUE_IS_ARRAY.
private
isArray(mixed $inputOption) : bool
Parameters
- $inputOption : mixed
-
The option being checked.
Return values
bool —Whether is an array or not.