<?php

namespace CouponsPlus\App\Conditions\BuiltIn\Conditions\Time;

use Carbon\Carbon;
use CouponsPlus\App\Conditions\BuiltIn\Conditions\Time\Abilities\CheckableTime;

/**
 * At least one checker must match
 */
class TimeCheckerORComposite extends TimeCheckerComposite implements CheckableTime
{
    public function matches(Carbon $date): bool
    {
        // rather easy
        foreach ($this->timeCheckers as $checker) {
            if ($checker->matches($date)) {
                return true;
            }
        }

        return false;
    }
}