CronExpression.php
public function setExpression($expression)
    {
        $definitions = 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($definitions[$expression])) {
            $expression = $definitions[$expression];
        }

        $expressionParts = explode(' ', $expression);

        if (count($expressionParts) < 5 || count($expressionParts) > 6) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid CRON expression.', $expression));
        }

        $this->expression = $expression;
        $this->fields = array();

        foreach ($expressionParts as $position => $value) {
            $this->fields[$position] = $this->getField($position, $value);
        }
    }
public function setExpression($expression)
    {
        $definitions = 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($definitions[$expression])) {
            $expression = $definitions[$expression];
        }

        $expressionParts = explode(' ', $expression);

        if (count($expressionParts) < 5 || count($expressionParts) > 6) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid CRON expression.', $expression));
        }

        $this->expression = $expression;
        $this->fields = array();

        foreach ($expressionParts as $position => $value) {
            $this->fields[$position] = $this->getField($position, $value);
        }
    }
public function setExpression ( $ expression ) { $ definitions = 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 ( $ definitions [ $ expression ] ) ) { $ expression = $ definitions [ $ expression ] ; } $ expressionParts = explode ( ' ' , $ expression ) ; if ( count ( $ expressionParts ) < 5 || count ( $ expressionParts ) > 6 ) { throw new \ InvalidArgumentException ( sprintf ( '%s is not a valid CRON expression.' , $ expression ) ) ; } $ this -> expression = $ expression ; $ this -> fields = array ( ) ; foreach ( $ expressionParts as $ position => $ value ) { $ this -> fields [ $ position ] = $ this -> getField ( $ position , $ value ) ; } }
Set CRON expression.

@param string $expression

@throws \InvalidArgumentException
Set CRON expression .