1 | <?php |
||
16 | class Day implements Entity, IteratorAggregate |
||
17 | { |
||
18 | |||
19 | /** @var DateTimeInterface */ |
||
20 | private $date; |
||
21 | |||
22 | /** @var array */ |
||
23 | private $dishes = []; |
||
24 | |||
25 | /** |
||
26 | * Day constructor. |
||
27 | * @param DateTimeInterface $date |
||
28 | */ |
||
29 | 3 | public function __construct(DateTimeInterface $date) |
|
33 | |||
34 | /** |
||
35 | * @param Dish $dish |
||
36 | */ |
||
37 | 3 | public function addDish(Dish $dish): void |
|
43 | |||
44 | /** |
||
45 | * @param int $index |
||
46 | * @return Dish |
||
47 | * @throws DishNotFoundException |
||
48 | */ |
||
49 | public function getDish(int $index): Dish |
||
57 | |||
58 | /** |
||
59 | * @return DateTimeInterface |
||
60 | */ |
||
61 | public function getDate(): DateTimeInterface |
||
65 | |||
66 | /** |
||
67 | * @param \stdClass $jsonObject |
||
68 | * @return Day |
||
69 | */ |
||
70 | 3 | public static function fromJson(\stdClass $jsonObject): self |
|
82 | |||
83 | /** |
||
84 | * @return int |
||
85 | */ |
||
86 | 3 | public function getDayOfWeek(): int |
|
90 | |||
91 | /** |
||
92 | * Retrieve an external iterator |
||
93 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
94 | * @return Traversable An instance of an object implementing <b>Iterator</b> or |
||
95 | * <b>Traversable</b> |
||
96 | * @since 5.0.0 |
||
97 | */ |
||
98 | 3 | public function getIterator(): Traversable |
|
102 | |||
103 | /** |
||
104 | * Specify data which should be serialized to JSON |
||
105 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
106 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
107 | * which is a value of any type other than a resource. |
||
108 | * @since 5.4.0 |
||
109 | */ |
||
110 | public function jsonSerialize(): array |
||
119 | } |