src/Service/Registry.php
public static function register(
        $code,
        $frequency,
        $callback,
        array $args = array()
    ) {
        if (!is_callable($callback)) {
            throw new \RuntimeException('The callback must be callable');
        }
        /*
         * validation of $frequency (cron expression):
         * will be done together when scheduling
         * (errors thrown if invalid cron expression)
         */

        $instance = self::getInstance();
        $cronRegistry = $instance->getCronRegistry();

        $cronRegistry[$code] = array(
            'frequency' => $frequency,
            'callback'  => $callback,
            'args'      => $args,
        );
        $instance->setCronRegistry($cronRegistry);

        return $instance;
    }
public static function register(
        $code,
        $frequency,
        $callback,
        array $args = array()
    ) {
        if (!is_callable($callback)) {
            throw new \RuntimeException('The callback must be callable');
        }
        /*
         * validation of $frequency (cron expression):
         * will be done together when scheduling
         * (errors thrown if invalid cron expression)
         */

        $instance = self::getInstance();
        $cronRegistry = $instance->getCronRegistry();

        $cronRegistry[$code] = array(
            'frequency' => $frequency,
            'callback'  => $callback,
            'args'      => $args,
        );
        $instance->setCronRegistry($cronRegistry);

        return $instance;
    }
public static function register ( $ code , $ frequency , $ callback , array $ args = array ( ) ) { if ( ! is_callable ( $ callback ) ) { throw new \ RuntimeException ( 'The callback must be callable' ) ; } /*
         * validation of $frequency (cron expression):
         * will be done together when scheduling
         * (errors thrown if invalid cron expression)
         */ $ instance = self :: getInstance ( ) ; $ cronRegistry = $ instance -> getCronRegistry ( ) ; $ cronRegistry [ $ code ] = array ( 'frequency' => $ frequency , 'callback' => $ callback , 'args' => $ args , ) ; $ instance -> setCronRegistry ( $ cronRegistry ) ; return $ instance ; }
register a cron job

@see Cron::trySchedule() for allowed cron expression syntax

@param  string   $code      the cron job code / identifier
@param  string   $frequency cron expression
@param  callable $callback  the actual cron job
@param  array    $args      args to the cron job
@return self
register a cron job