Cron\Schedule\CrontabSchedule::valid PHP Method

valid() public method

Validate if this pattern can run on the given date.
public valid ( DateTime $now ) : boolean
$now DateTime
return boolean
    public function valid(\DateTime $now)
    {
        if (false === $this->checkMinute($now)) {
            return false;
        }
        if (false === $this->checkHour($now)) {
            return false;
        }
        if (false === $this->checkDay($now)) {
            return false;
        }
        if (false === $this->checkMonth($now)) {
            return false;
        }
        if (false === $this->checkDayOfWeek($now)) {
            return false;
        }
        return true;
    }