1 | <?php |
||
9 | class OpeningHours |
||
10 | { |
||
11 | /** @var \Spatie\OpeningHours\Day[] */ |
||
12 | protected $openingHours; |
||
13 | |||
14 | /** @var array */ |
||
15 | protected $exceptions = []; |
||
16 | |||
17 | public function __construct() |
||
23 | |||
24 | /** |
||
25 | * @param array $data |
||
26 | * |
||
27 | * @return static |
||
28 | */ |
||
29 | public static function create(array $data) |
||
33 | |||
34 | public function fill(array $data) |
||
46 | |||
47 | public function forWeek(): array |
||
51 | |||
52 | public function forDay(string $day): OpeningHoursForDay |
||
58 | |||
59 | public function forDate(DateTime $date): OpeningHoursForDay |
||
63 | |||
64 | public function exceptions(): array |
||
68 | |||
69 | public function isOpenOn(string $day): bool |
||
73 | |||
74 | public function isClosedOn(string $day): bool |
||
78 | |||
79 | public function isOpenAt(DateTime $dateTime): bool |
||
85 | |||
86 | public function isClosedAt(DateTime $dateTime): bool |
||
90 | |||
91 | public function isOpen(): bool |
||
95 | |||
96 | public function isClosed(): bool |
||
100 | |||
101 | protected function parseOpeningHoursAndExceptions(array $data): array |
||
112 | |||
113 | protected function setOpeningHoursFromStrings(string $day, array $openingHours) |
||
119 | |||
120 | protected function setExceptionsFromStrings(array $exceptions) |
||
126 | |||
127 | protected function normalizeDayName(string $day) |
||
137 | } |
||
138 |