PHP Class Laravel\Envoy\TaskContainer

Show file Open project: laravel/envoy Class Usage Examples

Protected Properties

Property Type Description
$after array All of the "after" callbacks.
$error array All of the "error" callbacks.
$finished array All of the "finished" callbacks.
$macroOptions array All of the options for each macro.
$macroStack array The stack of macro being rendered.
$macros array All of the registered macros.
$servers array All of the registered servers.
$sharedData array All of the shared data.
$taskOptions array All of the options for each task.
$taskStack array The stack of tasks being rendered.
$tasks array All of the evaluated tasks.

Public Methods

Method Description
after ( Closure $callback ) : void Register an after-task callback.
endMacro ( ) : void Stop defining a macro.
endTask ( ) : void Stop defining a task.
error ( Closure $callback ) : void Register an error-task callback.
finished ( Closure $callback ) : void Register an finished-task callback.
getAfterCallbacks ( ) : array Get all of the after-task callbacks.
getErrorCallbacks ( ) : array Get all of the error-task callbacks.
getFinishedCallbacks ( ) : array Get all of the finished-task callbacks.
getFirstServer ( ) : string Get the first registered server IP address.
getMacro ( string $macro ) : array | null Get the given macro from the container.
getMacroOptions ( string $macro ) : array Get the macro options for the given macro.
getMacros ( ) : array Getter for macros.
getServer ( string $server ) : string | null Get the IP address for a server.
getTask ( string $task, array $macroOptions = [] ) : Task Get a Task instance by the given name.
getTaskOptions ( string $task ) : array Get the task options for the given task.
getTasks ( ) : array Getter for tasks.
hasOneServer ( ) : boolean Determine if the container only has one registered server.
import ( string $file, array $data = [] ) : void Import the given file into the container.
load ( string $__path, Compiler $__compiler, array $__data = [], boolean $__serversOnly = false ) : void Load the Envoy file into the container.
loadServers ( string $path, Compiler $compiler ) : void Silently load the Envoy file into the container.
servers ( array $servers ) : void Register the array of servers with the container.
share ( string $key, mixed $value ) : void Share the given piece of data across all tasks.
startMacro ( string $macro, array $options = [] ) : void Begin defining a macro.
startTask ( string $task, array $options = [] ) : void Begin defining a task.

Protected Methods

Method Description
getServers ( array $options ) : array Get the IP addresses of the servers specified on the options.
mergeDefaultOptions ( array $options ) : array Merge the option array over the default options.
replaceSubTasks ( ) : void Replace all of the sub tasks and trim leading spaces.
resolveImportPath ( string $file ) : string | boolean Resolve the import path for the given file.
trimSpaces ( string $value ) : string Remove the leading space from the lines of a value.
writeCompiledEnvoyFile ( Compiler $compiler, string $path, boolean $serversOnly ) : string Write the compiled Envoy file to disk.

Method Details

after() public method

Register an after-task callback.
public after ( Closure $callback ) : void
$callback Closure
return void

endMacro() public method

Stop defining a macro.
public endMacro ( ) : void
return void

endTask() public method

Stop defining a task.
public endTask ( ) : void
return void

error() public method

Register an error-task callback.
public error ( Closure $callback ) : void
$callback Closure
return void

finished() public method

Register an finished-task callback.
public finished ( Closure $callback ) : void
$callback Closure
return void

getAfterCallbacks() public method

Get all of the after-task callbacks.
public getAfterCallbacks ( ) : array
return array

getErrorCallbacks() public method

Get all of the error-task callbacks.
public getErrorCallbacks ( ) : array
return array

getFinishedCallbacks() public method

Get all of the finished-task callbacks.
public getFinishedCallbacks ( ) : array
return array

getFirstServer() public method

Get the first registered server IP address.
public getFirstServer ( ) : string
return string

getMacro() public method

Get the given macro from the container.
public getMacro ( string $macro ) : array | null
$macro string
return array | null

getMacroOptions() public method

Get the macro options for the given macro.
public getMacroOptions ( string $macro ) : array
$macro string
return array

getMacros() public method

Getter for macros.
public getMacros ( ) : array
return array

getServer() public method

Get the IP address for a server.
public getServer ( string $server ) : string | null
$server string
return string | null

getServers() protected method

Get the IP addresses of the servers specified on the options.
protected getServers ( array $options ) : array
$options array
return array

getTask() public method

Get a Task instance by the given name.
public getTask ( string $task, array $macroOptions = [] ) : Task
$task string
$macroOptions array
return Task

getTaskOptions() public method

Get the task options for the given task.
public getTaskOptions ( string $task ) : array
$task string
return array

getTasks() public method

Getter for tasks.
public getTasks ( ) : array
return array

hasOneServer() public method

Determine if the container only has one registered server.
public hasOneServer ( ) : boolean
return boolean

import() public method

Import the given file into the container.
public import ( string $file, array $data = [] ) : void
$file string
$data array
return void

load() public method

Load the Envoy file into the container.
public load ( string $__path, Compiler $__compiler, array $__data = [], boolean $__serversOnly = false ) : void
$__path string
$__compiler Compiler
$__data array
$__serversOnly boolean
return void

loadServers() public method

No data is needed.
public loadServers ( string $path, Compiler $compiler ) : void
$path string
$compiler Compiler
return void

mergeDefaultOptions() protected method

Merge the option array over the default options.
protected mergeDefaultOptions ( array $options ) : array
$options array
return array

replaceSubTasks() protected method

Replace all of the sub tasks and trim leading spaces.
protected replaceSubTasks ( ) : void
return void

resolveImportPath() protected method

Resolve the import path for the given file.
protected resolveImportPath ( string $file ) : string | boolean
$file string
return string | boolean

servers() public method

Register the array of servers with the container.
public servers ( array $servers ) : void
$servers array
return void

share() public method

Share the given piece of data across all tasks.
public share ( string $key, mixed $value ) : void
$key string
$value mixed
return void

startMacro() public method

Begin defining a macro.
public startMacro ( string $macro, array $options = [] ) : void
$macro string
$options array
return void

startTask() public method

Begin defining a task.
public startTask ( string $task, array $options = [] ) : void
$task string
$options array
return void

trimSpaces() protected method

Remove the leading space from the lines of a value.
protected trimSpaces ( string $value ) : string
$value string
return string

writeCompiledEnvoyFile() protected method

Write the compiled Envoy file to disk.
protected writeCompiledEnvoyFile ( Compiler $compiler, string $path, boolean $serversOnly ) : string
$compiler Compiler
$path string
$serversOnly boolean
return string

Property Details

$after protected property

All of the "after" callbacks.
protected array $after
return array

$error protected property

All of the "error" callbacks.
protected array $error
return array

$finished protected property

All of the "finished" callbacks.
protected array $finished
return array

$macroOptions protected property

All of the options for each macro.
protected array $macroOptions
return array

$macroStack protected property

The stack of macro being rendered.
protected array $macroStack
return array

$macros protected property

All of the registered macros.
protected array $macros
return array

$servers protected property

All of the registered servers.
protected array $servers
return array

$sharedData protected property

All of the shared data.
protected array $sharedData
return array

$taskOptions protected property

All of the options for each task.
protected array $taskOptions
return array

$taskStack protected property

The stack of tasks being rendered.
protected array $taskStack
return array

$tasks protected property

All of the evaluated tasks.
protected array $tasks
return array