1<?php
2
3
4namespace ComboStrap;
5
6
7use Cron\CronExpression;
8
9class Cron
10{
11
12
13    /**
14     * @throws ExceptionCombo
15     */
16    public static function getDate(string $cronExpression): \DateTime
17    {
18        try {
19            $cron = CronExpression::factory($cronExpression);
20            return $cron->getNextRunDate();
21        } catch (\InvalidArgumentException $e) {
22            throw new ExceptionCombo("The cache frequency expression ($cronExpression) is not a valid cron expression. <a href=\"https://crontab.guru/\">Validate it on this website</a>");
23        }
24    }
25}
26