PHP Класс Crunz\Event

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$description string The human readable description of the event.
$output string The location that output should be sent to.
$outputStream string Event generated output
$preventOverlapping boolean Indicates if the command should not overlap itself.
$shouldAppendOutput boolean Indicates whether output should be appended.

Защищенные свойства (Protected)

Свойство Тип Описание
$afterCallbacks array The array of callbacks to be run after the event is finished.
$beforeCallbacks array The array of callbacks to be run before the event is started.
$command string The command string.
$cwd string Current working directory
$expression string The cron expression representing the event's frequency.
$fieldsPosition array Position of cron fields
$filters array The array of filter callbacks.
$id string The event's unique identifier
$process Symfony\Component\Process\Process Process that runs the event
$rejects array The array of reject callbacks.
$timezone DateTimeZone | string The timezone the date should be evaluated on.
$user string The user the command should run as.

Открытые методы

Метод Описание
__call ( string $methodName, array $params ) Handling dynamic frequency methods
__construct ( $id, string $command ) : void Create a new event instance.
after ( Closure $callback ) Register a callback to be called after the operation.
afterCallbacks ( ) : array Return all registered after callbacks
appendOutputTo ( string $location ) Append the output of the command to a given location.
at ( string $time ) Schedule the command at a given time.
before ( Closure $callback ) Register a callback to be called before the operation.
beforeCallbacks ( ) : array Return all registered before callbacks
between ( $from, $to ) Set Working period
buildCommand ( ) : string Build the comand string.
cron ( string $expression ) The Cron expression representing the event's frequency.
daily ( ) Schedule the event to run daily.
dailyAt ( string $time ) Schedule the event to run daily at a given time (10:00, 19:30, etc).
dayOfMonth ( mixed $value ) Set hour for the cron job
dayOfWeek ( mixed $value ) Set hour for the cron job
days ( mixed $days ) Set the days of the week the command should run on.
description ( string $description ) Set the human-friendly description of the event.
every ( string $unit = null, string $value = null ) Another way to the frequency of the cron job
filtersPass ( ) : boolean Determine if the filters pass for the event.
fridays ( ) Schedule the event to run only on Fridays.
from ( string $datetime ) Check if event should be on
getCommand ( ) : string Return the event's command
getCommandForDisplay ( ) : string Get the command for display
getExpression ( ) : string Get the Cron expression for the event.
getId ( ) : string Return the event's command
getOutputStream ( ) : string Return event's full output
getProcess ( ) : Process Return the event's process
getSummaryForDisplay ( ) : string Get the summary of the event for display.
getWorkingDirectory ( ) : string Return the current working directory
hour ( mixed $value ) Set hour for the cron job
hourly ( ) Schedule the event to run hourly.
in ( string $directory ) Change the current working directory.
isClosure ( ) : boolean Determine whether the passed value is a closure ot not.
isDue ( ) : boolean Determine if the given event should run based on the Cron expression.
isLocked ( ) : boolean Check if another instance of the event is still running
lastPid ( ) : integer Get the last process Id of the event
lockFile ( ) : string Get the lock file path for the task
minute ( mixed $value ) Set minute for the cron job
mondays ( ) Schedule the event to run only on Mondays.
month ( mixed $value ) Set hour for the cron job
monthly ( ) Schedule the event to run monthly.
name ( string $description ) Set the human-friendly description of the event.
nullOutput ( ) : boolean Determine if the event's output is sent to null.
on ( string $date ) Schedule the event to run on a certain date
pingBefore ( string $url ) Register a callback to ping a given URL before the job runs.
preventOverlapping ( ) Do not allow the event to overlap each other.
quarterly ( ) Schedule the event to run quarterly.
saturdays ( ) Schedule the event to run only on Saturdays.
sendOutputTo ( string $location, boolean $append = false ) Send the output of the command to a given location.
setCommand ( string $command ) Set the event's command
setProcess ( Process $process = null ) Set the event's process
skip ( Closure $callback ) Register a callback to further filter the schedule.
start ( ) : integer Start the event execution
sundays ( ) Schedule the event to run only on Sundays.
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.
thursdays ( ) Schedule the event to run only on Thursdays.
timezone ( DateTimeZone | string $timezone ) Set the timezone the date should be evaluated on.
to ( string $datetime ) Check if event should be off
tuesdays ( ) Schedule the event to run only on Tuesdays.
twiceDaily ( integer $first = 1, integer $second = 13 ) Schedule the event to run twice daily.
user ( string $user ) Set which user the command should run as.
wednesdays ( ) Schedule the event to run only on Wednesdays.
weekdays ( ) Schedule the event to run only on weekdays.
weekly ( ) Schedule the event to run weekly.
weeklyOn ( integer $day, string $time = '0:0' ) Schedule the event to run weekly on a given day and time.
when ( Closure $callback ) Register a callback to further filter the schedule.
yearly ( ) Schedule the event to run yearly.

Защищенные методы

Метод Описание
applyMask ( string $unit ) : string Mask a cron expression
expressionPasses ( ) : boolean Determine if the Cron expression passes.
getDefaultOutput ( ) : string Get the default output depending on the OS.
lock ( ) : string Lock the event
notYet ( $datetime ) : boolean Check if time hasn't arrived
past ( $datetime ) : boolean Check if the time has passed
serializeClosure ( string $closure ) : string Convert closure to an executable command
spliceIntoPosition ( integer $position, string $value ) Splice the given value into the given position of the expression.
sudo ( string $user ) : string Add sudo to the command

Описание методов

__call() публичный Метод

Handling dynamic frequency methods
public __call ( string $methodName, array $params )
$methodName string
$params array

__construct() публичный Метод

Create a new event instance.
public __construct ( $id, string $command ) : void
$command string
Результат void

after() публичный Метод

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

afterCallbacks() публичный Метод

Return all registered after callbacks
public afterCallbacks ( ) : array
Результат array

appendOutputTo() публичный Метод

Append the output of the command to a given location.
public appendOutputTo ( string $location )
$location string

applyMask() защищенный Метод

Mask a cron expression
protected applyMask ( string $unit ) : string
$unit string
Результат string

at() публичный Метод

Schedule the command at a given time.
public at ( string $time )
$time string

before() публичный Метод

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

beforeCallbacks() публичный Метод

Return all registered before callbacks
public beforeCallbacks ( ) : array
Результат array

between() публичный Метод

Set Working period
public between ( $from, $to )

buildCommand() публичный Метод

Build the comand string.
public buildCommand ( ) : string
Результат string

cron() публичный Метод

The Cron expression representing the event's frequency.
public cron ( string $expression )
$expression string

daily() публичный Метод

Schedule the event to run daily.
public daily ( )

dailyAt() публичный Метод

Schedule the event to run daily at a given time (10:00, 19:30, etc).
public dailyAt ( string $time )
$time string

dayOfMonth() публичный Метод

Set hour for the cron job
public dayOfMonth ( mixed $value )
$value mixed

dayOfWeek() публичный Метод

Set hour for the cron job
public dayOfWeek ( mixed $value )
$value mixed

days() публичный Метод

Set the days of the week the command should run on.
public days ( mixed $days )
$days mixed

description() публичный Метод

Set the human-friendly description of the event.
public description ( string $description )
$description string

every() публичный Метод

Another way to the frequency of the cron job
public every ( string $unit = null, string $value = null )
$unit string
$value string

expressionPasses() защищенный Метод

Determine if the Cron expression passes.
protected expressionPasses ( ) : boolean
Результат boolean

filtersPass() публичный Метод

Determine if the filters pass for the event.
public filtersPass ( ) : boolean
Результат boolean

fridays() публичный Метод

Schedule the event to run only on Fridays.
public fridays ( )

from() публичный Метод

Check if event should be on
public from ( string $datetime )
$datetime string

getCommand() публичный Метод

Return the event's command
public getCommand ( ) : string
Результат string

getCommandForDisplay() публичный Метод

Get the command for display
public getCommandForDisplay ( ) : string
Результат string

getDefaultOutput() защищенный Метод

Get the default output depending on the OS.
protected getDefaultOutput ( ) : string
Результат string

getExpression() публичный Метод

Get the Cron expression for the event.
public getExpression ( ) : string
Результат string

getId() публичный Метод

Return the event's command
public getId ( ) : string
Результат string

getOutputStream() публичный Метод

Return event's full output
public getOutputStream ( ) : string
Результат string

getProcess() публичный Метод

Return the event's process
public getProcess ( ) : Process
Результат Symfony\Component\Process\Process $process

getSummaryForDisplay() публичный Метод

Get the summary of the event for display.
public getSummaryForDisplay ( ) : string
Результат string

getWorkingDirectory() публичный Метод

Return the current working directory
public getWorkingDirectory ( ) : string
Результат string

hour() публичный Метод

Set hour for the cron job
public hour ( mixed $value )
$value mixed

hourly() публичный Метод

Schedule the event to run hourly.
public hourly ( )

in() публичный Метод

Change the current working directory.
public in ( string $directory )
$directory string

isClosure() публичный Метод

Determine whether the passed value is a closure ot not.
public isClosure ( ) : boolean
Результат boolean

isDue() публичный Метод

Determine if the given event should run based on the Cron expression.
public isDue ( ) : boolean
Результат boolean

isLocked() публичный Метод

Check if another instance of the event is still running
public isLocked ( ) : boolean
Результат boolean

lastPid() публичный Метод

Get the last process Id of the event
public lastPid ( ) : integer
Результат integer

lock() защищенный Метод

Lock the event
protected lock ( ) : string
Результат string

lockFile() публичный Метод

Get the lock file path for the task
public lockFile ( ) : string
Результат string

minute() публичный Метод

Set minute for the cron job
public minute ( mixed $value )
$value mixed

mondays() публичный Метод

Schedule the event to run only on Mondays.
public mondays ( )

month() публичный Метод

Set hour for the cron job
public month ( mixed $value )
$value mixed

monthly() публичный Метод

Schedule the event to run monthly.
public monthly ( )

name() публичный Метод

Set the human-friendly description of the event.
public name ( string $description )
$description string

notYet() защищенный Метод

Check if time hasn't arrived
protected notYet ( $datetime ) : boolean
Результат boolean

nullOutput() публичный Метод

Determine if the event's output is sent to null.
public nullOutput ( ) : boolean
Результат boolean

on() публичный Метод

Schedule the event to run on a certain date
public on ( string $date )
$date string

past() защищенный Метод

Check if the time has passed
protected past ( $datetime ) : boolean
Результат boolean

pingBefore() публичный Метод

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

preventOverlapping() публичный Метод

Do not allow the event to overlap each other.
public preventOverlapping ( )

quarterly() публичный Метод

Schedule the event to run quarterly.
public quarterly ( )

saturdays() публичный Метод

Schedule the event to run only on Saturdays.
public saturdays ( )

sendOutputTo() публичный Метод

Send the output of the command to a given location.
public sendOutputTo ( string $location, boolean $append = false )
$location string
$append boolean

serializeClosure() защищенный Метод

Convert closure to an executable command
protected serializeClosure ( string $closure ) : string
$closure string
Результат string

setCommand() публичный Метод

Set the event's command
public setCommand ( string $command )
$command string

setProcess() публичный Метод

Set the event's process
public setProcess ( Process $process = null )
$process Symfony\Component\Process\Process

skip() публичный Метод

Register a callback to further filter the schedule.
public skip ( Closure $callback )
$callback Closure

spliceIntoPosition() защищенный Метод

Splice the given value into the given position of the expression.
protected spliceIntoPosition ( integer $position, string $value )
$position integer
$value string

start() публичный Метод

Start the event execution
public start ( ) : integer
Результат integer

sudo() защищенный Метод

Add sudo to the command
protected sudo ( string $user ) : string
$user string
Результат string

sundays() публичный Метод

Schedule the event to run only on Sundays.
public sundays ( )

then() публичный Метод

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

thenPing() публичный Метод

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

thursdays() публичный Метод

Schedule the event to run only on Thursdays.
public thursdays ( )

timezone() публичный Метод

Set the timezone the date should be evaluated on.
public timezone ( DateTimeZone | string $timezone )
$timezone DateTimeZone | string

to() публичный Метод

Check if event should be off
public to ( string $datetime )
$datetime string

tuesdays() публичный Метод

Schedule the event to run only on Tuesdays.
public tuesdays ( )

twiceDaily() публичный Метод

Schedule the event to run twice daily.
public twiceDaily ( integer $first = 1, integer $second = 13 )
$first integer
$second integer

user() публичный Метод

Set which user the command should run as.
public user ( string $user )
$user string

wednesdays() публичный Метод

Schedule the event to run only on Wednesdays.
public wednesdays ( )

weekdays() публичный Метод

Schedule the event to run only on weekdays.
public weekdays ( )

weekly() публичный Метод

Schedule the event to run weekly.
public weekly ( )

weeklyOn() публичный Метод

Schedule the event to run weekly on a given day and time.
public weeklyOn ( integer $day, string $time = '0:0' )
$day integer
$time string

when() публичный Метод

Register a callback to further filter the schedule.
public when ( Closure $callback )
$callback Closure

yearly() публичный Метод

Schedule the event to run yearly.
public yearly ( )

Описание свойств

$afterCallbacks защищенное свойство

The array of callbacks to be run after the event is finished.
protected array $afterCallbacks
Результат array

$beforeCallbacks защищенное свойство

The array of callbacks to be run before the event is started.
protected array $beforeCallbacks
Результат array

$command защищенное свойство

The command string.
protected string $command
Результат string

$cwd защищенное свойство

Current working directory
protected string $cwd
Результат string

$description публичное свойство

The human readable description of the event.
public string $description
Результат string

$expression защищенное свойство

The cron expression representing the event's frequency.
protected string $expression
Результат string

$fieldsPosition защищенное свойство

Position of cron fields
protected array $fieldsPosition
Результат array

$filters защищенное свойство

The array of filter callbacks.
protected array $filters
Результат array

$id защищенное свойство

The event's unique identifier
protected string $id
Результат string

$output публичное свойство

The location that output should be sent to.
public string $output
Результат string

$outputStream публичное свойство

Event generated output
public string $outputStream
Результат string

$preventOverlapping публичное свойство

Indicates if the command should not overlap itself.
public bool $preventOverlapping
Результат boolean

$process защищенное свойство

Process that runs the event
protected Process,Symfony\Component\Process $process
Результат Symfony\Component\Process\Process

$rejects защищенное свойство

The array of reject callbacks.
protected array $rejects
Результат array

$shouldAppendOutput публичное свойство

Indicates whether output should be appended.
public bool $shouldAppendOutput
Результат boolean

$timezone защищенное свойство

The timezone the date should be evaluated on.
protected DateTimeZone|string $timezone
Результат DateTimeZone | string

$user защищенное свойство

The user the command should run as.
protected string $user
Результат string