1 | <?php |
||
14 | class Week implements Entity, IteratorAggregate |
||
15 | { |
||
16 | /** @var int */ |
||
17 | private $weekNumber; |
||
18 | |||
19 | /** @var array */ |
||
20 | private $days = []; |
||
21 | |||
22 | /** |
||
23 | * Week constructor. |
||
24 | * @param $weekNumber |
||
25 | */ |
||
26 | 3 | public function __construct($weekNumber) |
|
30 | |||
31 | /** |
||
32 | * @param \stdClass $jsonObject |
||
33 | * @return Week |
||
34 | */ |
||
35 | 3 | public static function fromJson(\stdClass $jsonObject): self |
|
46 | |||
47 | /** |
||
48 | * @return int |
||
49 | */ |
||
50 | 3 | public function getWeekNumber(): int |
|
54 | |||
55 | /** |
||
56 | * @param Day $day |
||
57 | */ |
||
58 | 3 | public function addDay(Day $day): void |
|
62 | |||
63 | /** |
||
64 | * @param int $dayOfWeek |
||
65 | * @return Day |
||
66 | * @throws DayNotFoundException |
||
67 | */ |
||
68 | 3 | public function getDay(int $dayOfWeek): Day |
|
76 | |||
77 | /** |
||
78 | * Retrieve an external iterator |
||
79 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
80 | * @return Traversable An instance of an object implementing <b>Iterator</b> or |
||
81 | * <b>Traversable</b> |
||
82 | * @since 5.0.0 |
||
83 | */ |
||
84 | public function getIterator(): Traversable |
||
88 | |||
89 | /** |
||
90 | * Specify data which should be serialized to JSON |
||
91 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
92 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
93 | * which is a value of any type other than a resource. |
||
94 | * @since 5.4.0 |
||
95 | */ |
||
96 | public function jsonSerialize(): array |
||
105 | } |