PHP Class Crunz\Schedule

Mostra file Open project: lavary/crunz Class Usage Examples

Protected Properties

Property Type Description
$afterCallbacks array The array of callbacks to be run after all the event is finished.
$beforeCallbacks array The array of callbacks to be run before all the events are finished
$errorCallbacks array The array of callbacks to call in case of an error.
$events array All of the events on the schedule.

Public Methods

Method Description
after ( Closure $callback ) Register a callback to be called after the operation.
afterCallbacks ( ) : array Return all registered after callbacks
before ( Closure $callback ) Register a callback to be called before the operation.
beforeCallbacks ( ) : array Return all registered before callbacks
dismissEvent ( integer $key ) Dismiss an event after it is finished
dueEvents ( ) : array Get all of the events on the schedule that are due.
errorCallbacks ( ) : array Return all registered error callbacks
events ( array $events = null ) : array Get or set the events of the schedule object
onError ( Closure $callback ) Register a callback to call in case of an error
pingBefore ( string $url ) Register a callback to ping a given URL before the job runs.
run ( string $command, array $parameters = [] ) : Event Add a new event to the schedule object.
then ( Closure $callback ) Register a callback to be called after the operation.
thenPing ( string $url ) Register a callback to ping a given URL after the job runs.

Protected Methods

Method Description
compileParameters ( array $parameters ) : string Compile parameters for a command.
id ( ) : string Generate a unique task id

Method Details

after() public method

Register a callback to be called after the operation.
public after ( Closure $callback )
$callback Closure

afterCallbacks() public method

Return all registered after callbacks
public afterCallbacks ( ) : array
return array

before() public method

Register a callback to be called before the operation.
public before ( Closure $callback )
$callback Closure

beforeCallbacks() public method

Return all registered before callbacks
public beforeCallbacks ( ) : array
return array

compileParameters() protected method

Compile parameters for a command.
protected compileParameters ( array $parameters ) : string
$parameters array
return string

dismissEvent() public method

Dismiss an event after it is finished
public dismissEvent ( integer $key )
$key integer

dueEvents() public method

Get all of the events on the schedule that are due.
public dueEvents ( ) : array
return array

errorCallbacks() public method

Return all registered error callbacks
public errorCallbacks ( ) : array
return array

events() public method

Get or set the events of the schedule object
public events ( array $events = null ) : array
$events array
return array

id() protected method

Generate a unique task id
protected id ( ) : string
return string

onError() public method

Register a callback to call in case of an error
public onError ( Closure $callback )
$callback Closure

pingBefore() public method

Register a callback to ping a given URL before the job runs.
public pingBefore ( string $url )
$url string

run() public method

Add a new event to the schedule object.
public run ( string $command, array $parameters = [] ) : Event
$command string
$parameters array
return Event

then() public method

Register a callback to be called after the operation.
public then ( Closure $callback )
$callback Closure

thenPing() public method

Register a callback to ping a given URL after the job runs.
public thenPing ( string $url )
$url string

Property Details

$afterCallbacks protected_oe property

The array of callbacks to be run after all the event is finished.
protected array $afterCallbacks
return array

$beforeCallbacks protected_oe property

The array of callbacks to be run before all the events are finished
protected array $beforeCallbacks
return array

$errorCallbacks protected_oe property

The array of callbacks to call in case of an error.
protected array $errorCallbacks
return array

$events protected_oe property

All of the events on the schedule.
protected array $events
return array