CronExpression::factory()public staticWC 1.0

Factory method to create a new CronExpression.

Метод класса: CronExpression{}

Хуков нет.

Возвращает

CronExpression.

Использование

$result = CronExpression::factory( $expression, $fieldFactory );
$expression(строка) (обязательный)
The CRON expression to create. There are
php several special predefined values which can be used to substitute the CRON expression:
@yearly, @annually) - Run once a year, midnight, Jan. 1 - 0 0 1 1 *
@monthly - Run once a month, midnight, first of month - 0 0 1 * *
@weekly - Run once a week, midnight on Sun - 0 0 * * 0
@daily - Run once a day, midnight - 0 0 * * *
@hourly - Run once an hour, first minute - 0 * * * *
$fieldFactory(CronExpression_FieldFactory)
(optional) Field factory to use
По умолчанию: null

Код CronExpression::factory() WC 8.7.0

public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null)
{
    $mappings = array(
        '@yearly' => '0 0 1 1 *',
        '@annually' => '0 0 1 1 *',
        '@monthly' => '0 0 1 * *',
        '@weekly' => '0 0 * * 0',
        '@daily' => '0 0 * * *',
        '@hourly' => '0 * * * *'
    );

    if (isset($mappings[$expression])) {
        $expression = $mappings[$expression];
    }

    return new self($expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory());
}