ConfigurationCommand
extends BaseTask
in package
implements
BuilderAwareInterface
Uses
BuilderAwareTrait
Execute the tasks from a Configuration command.
Interfaces, Classes, Traits and Enums
- BuilderAwareInterface
Table of Contents
- $availableTasks : array<string|int, mixed>
- Contains the available tasks and configuration.
- $tasks : array<string|int, mixed>
- An array with tasks to execute.
- __construct() : mixed
- Constructs a new Process task.
- getTasks() : array<string|int, mixed>
- Return the current tasks.
- run() : mixed
- Run the command tasks.
- taskExecute() : CollectionBuilder
- Execute single task.
- paramDefaultValue() : string|bool|mixed
- The default parameter values, return all or given parameter default value.
- prepareOutput() : mixed
- Prepares the Output of a taskExec.
- throwInvalidTaskException() : mixed
- Report missing parameter, this stops the execution.
- throwParamException() : mixed
- Report missing parameter, this stops the execution.
- validateAndEnsureParameters() : mixed
- Validate and ensure the parameter are met.
Properties
$availableTasks
Contains the available tasks and configuration.
protected
array<string|int, mixed>
$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'],
// 'process-php' => ['required' => ['source', 'destination'], 'defaults' => 'override'],
'exec' => ['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, mixed>
$tasks
Methods
__construct()
Constructs a new Process task.
public
__construct(array<string|int, mixed> $tasks) : mixed
Parameters
- $tasks : array<string|int, mixed>
-
The Command Tasks.
Return values
mixed —getTasks()
Return the current tasks.
public
getTasks() : array<string|int, mixed>
Return values
array<string|int, mixed> —The tasks.
run()
Run the command tasks.
public
run() : mixed
Return values
mixed —taskExecute()
Execute single task.
protected
taskExecute( $task) : CollectionBuilder
Parameters
Tags
Return values
CollectionBuilder —paramDefaultValue()
The default parameter values, return all or given parameter default value.
private
paramDefaultValue(string $key) : string|bool|mixed
Parameters
- $key : string
-
The parameter name.
Return values
string|bool|mixed —The default value for given name.
prepareOutput()
Prepares the Output of a taskExec.
private
prepareOutput( $taskExec) : mixed
Parameters
Return values
mixed —throwInvalidTaskException()
Report missing parameter, this stops the execution.
private
throwInvalidTaskException(string $task) : mixed
Parameters
- $task : string
-
The task being checked.
Tags
Return values
mixed —throwParamException()
Report missing parameter, this stops the execution.
private
throwParamException(string $param, string $task) : mixed
Parameters
- $param : string
-
The missing parameter.
- $task : string
-
The task being checked.
Tags
Return values
mixed —validateAndEnsureParameters()
Validate and ensure the parameter are met.
private
validateAndEnsureParameters( &$task) : mixed