Building from an array

It is possible to build a Cron manager from an array using the Factory class:

use Centum\Cron\CronFactory;

$cronFactory = new CronFactory();

$cron = $cronFactory->createFromArray(
    [
        [
            "* * * * *",
            "sh do-something.sh",
        ],

        [
            "@weekly",
            "sh purge-cache.sh",
        ],

        [
            "@daily",
            "sh backup.sh",
        ],
    ]
);

$dueJobs = $cron->getDueJobs();

This could be useful if you wanted to store your cron jobs in a non-PHP config file.