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;
    }