PHP Class CronLingo\Parser

Class Parser
Datei anzeigen Open project: ajbdev/cronlingo Class Usage Examples

Protected Properties

Property Type Description
$cron Cron
$dayOfWeekMap array
$fieldMap array
$intervalMap array
$monthMap array
$position integer
$timeOfDayMap array
$tokenMap array Regular expressions used to tokenize a string
$tokens array Array of lexed tokens
$weekdayWeekendMap array

Public Methods

Method Description
expects ( $token, $types ) Enforce expectations of a certain token
parse ( $value ) : string Parse a string into a CRON expression
reset ( ) Reset parser token position and CRON expression

Protected Methods

Method Description
compileRegex ( ) : string Concatenate regex expressions into a single regex for performance
current ( ) : array Retrieve current token based on position
evaluate ( ) Evaluate tokens and build CRON expression
is ( $token, $types ) : boolean Check if a token is of a type
lex ( $string ) : array Lex a string into tokens
next ( integer $skip = 1 ) : boolean Look ahead in the token array
nilTime ( $field ) For simple expressions, zero out the time so the cron matches user expectation and does not execute constantly.
previous ( integer $skip = 1 ) : boolean Look behind in the token array
seek ( $index ) : boolean Seek a specific token

Method Details

compileRegex() protected method

Concatenate regex expressions into a single regex for performance
protected compileRegex ( ) : string
return string

current() protected method

Retrieve current token based on position
protected current ( ) : array
return array

evaluate() protected method

Evaluate tokens and build CRON expression
protected evaluate ( )

expects() public method

Enforce expectations of a certain token
public expects ( $token, $types )
$token
$types

is() protected method

Check if a token is of a type
protected is ( $token, $types ) : boolean
$token
$types
return boolean

lex() protected method

Lex a string into tokens
protected lex ( $string ) : array
$string
return array

next() protected method

Look ahead in the token array
protected next ( integer $skip = 1 ) : boolean
$skip integer
return boolean

nilTime() protected method

E.g., someone would not expect "Every day on Tuesday" to run for every minute and hour on Tuesday.
protected nilTime ( $field )
$field

parse() public method

Parse a string into a CRON expression
public parse ( $value ) : string
$value
return string

previous() protected method

Look behind in the token array
protected previous ( integer $skip = 1 ) : boolean
$skip integer
return boolean

reset() public method

Reset parser token position and CRON expression
public reset ( )

seek() protected method

Seek a specific token
protected seek ( $index ) : boolean
$index
return boolean

Property Details

$cron protected_oe property

protected Cron,cronlingo $cron
return Cron

$dayOfWeekMap protected_oe property

protected array $dayOfWeekMap
return array

$fieldMap protected_oe property

protected array $fieldMap
return array

$intervalMap protected_oe property

protected array $intervalMap
return array

$monthMap protected_oe property

protected array $monthMap
return array

$position protected_oe property

protected int $position
return integer

$timeOfDayMap protected_oe property

protected array $timeOfDayMap
return array

$tokenMap protected_oe property

Regular expressions used to tokenize a string
protected array $tokenMap
return array

$tokens protected_oe property

Array of lexed tokens
protected array $tokens
return array

$weekdayWeekendMap protected_oe property

protected array $weekdayWeekendMap
return array