<?php

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

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

class HoursChecker implements CheckableTime
{
    /**
     * @var int 0-23
     */
    protected int $hour;

    public function __construct(int $hour)
    {
        $this->hour = $hour;
    }

    public function matches(Carbon $date): bool
    {
        return $date->hour === $this->hour;
    }
}