ConfigurationCommand
extends BaseTask
in package
implements
BuilderAwareInterface
uses
BuilderAwareTrait
Execute the tasks from a Configuration command.
Table of Contents
Interfaces
- BuilderAwareInterface
Properties
- $availableTasks : array<string|int, array<string|int, string>>
- Contains the available tasks and configuration.
- $tasks : array<string|int, array<string|int, string>>
- An array with tasks to execute.
Methods
- __construct() : mixed
- Constructs a new Process task.
- getTasks() : array<string|int, string>|array<string|int, array<string|int, string>>
- Return the current tasks.
- run() : mixed
- Run the command tasks.
- taskExecute() : mixed
- Execute single task.
- paramDefaultValue() : mixed
- The default parameter values, return all or given parameter default value.
- prepareOutput() : void
- Prepares the Output of a taskExec.
- throwInvalidTaskException() : void
- Report missing parameter, this stops the execution.
- throwParamException() : void
- Report missing parameter, this stops the execution.
- validateAndEnsureParameters() : void
- Validate and ensure the parameter are met.
Properties
$availableTasks
Contains the available tasks and configuration.
protected
array<string|int, array<string|int, string>>
$availableTasks
= ['mkdir' => ['required' => 'dir', 'defaults' => 'mode'], 'touch' => ['required' => 'file', 'defaults' => ['time', 'atime']], 'copy' => ['required' => ['from', 'to'], 'defaults' => 'force'], 'copy-dir' => ['required' => ['from', 'to']], 'rename' => ['required' => ['from', 'to'], 'defaults' => 'force'], 'chmod' => ['required' => ['file', 'permissions'], 'defaults' => ['umask', 'recursive']], 'chgrp' => ['required' => ['file', 'group'], 'defaults' => 'recursive'], 'chown' => ['required' => ['file', 'user'], 'defaults' => 'recursive'], 'remove' => ['required' => 'file'], 'symlink' => ['required' => ['from', 'to']], 'mirror' => ['required' => ['from', 'to']], 'process' => ['required' => ['source'], 'defaults' => 'destination'], 'append' => ['required' => ['file', 'text']], 'run' => ['required' => 'command'], 'exec' => ['required' => 'command'], 'drush' => ['required' => 'command'], 'replace-block' => ['required' => ['filename', 'start', 'end'], 'defaults' => ['content', 'excludeStartEnd']]]
Each task defines all the needed parameters to execute, the required to ensure they are present, and the defaults to ensure they have the default value.
$tasks
An array with tasks to execute.
protected
array<string|int, array<string|int, string>>
$tasks
Methods
__construct()
Constructs a new Process task.
public
__construct(array<string|int, array<string|int, string>> $tasks) : mixed
Parameters
- $tasks : array<string|int, array<string|int, string>>
-
The Command Tasks.
getTasks()
Return the current tasks.
public
getTasks() : array<string|int, string>|array<string|int, array<string|int, string>>
Return values
array<string|int, string>|array<string|int, array<string|int, string>> —An array with tasks to execute.
run()
Run the command tasks.
public
run() : mixed
taskExecute()
Execute single task.
protected
taskExecute(array<string|int, string>|array<string|int, array<string|int, string>> $task) : mixed
Parameters
- $task : array<string|int, string>|array<string|int, array<string|int, string>>
-
The task to execute.
Tags
Return values
mixed —The task to be executed.
paramDefaultValue()
The default parameter values, return all or given parameter default value.
private
paramDefaultValue(string $key) : mixed
Parameters
- $key : string
-
The parameter name.
Return values
mixed —The default value for given name.
prepareOutput()
Prepares the Output of a taskExec.
private
prepareOutput(Exec $taskExec) : void
Parameters
- $taskExec : Exec
-
The task exec being executed.
Return values
void —Print the output.
throwInvalidTaskException()
Report missing parameter, this stops the execution.
private
throwInvalidTaskException(string $task) : void
Parameters
- $task : string
-
The task being checked.
Tags
Return values
void —The invalid exception message.
throwParamException()
Report missing parameter, this stops the execution.
private
throwParamException(string $param, string $task) : void
Parameters
- $param : string
-
The missing parameter.
- $task : string
-
The task being checked.
Tags
Return values
void —The parameter exception message.
validateAndEnsureParameters()
Validate and ensure the parameter are met.
private
validateAndEnsureParameters(string|array<string|int, string> &$task) : void
Parameters
- $task : string|array<string|int, string>
-
The task being executed.
Tags
Return values
void —Validate and ensure the parameter are met.