1 | <?php |
||
13 | class Year implements Entity, IteratorAggregate |
||
14 | { |
||
15 | /** @var int */ |
||
16 | private $yearNumber; |
||
17 | |||
18 | /** @var array */ |
||
19 | private $weeks = []; |
||
20 | |||
21 | /** |
||
22 | * Year constructor. |
||
23 | * @param int|null $yearNumber |
||
24 | */ |
||
25 | public function __construct(int $yearNumber = null) |
||
33 | |||
34 | /** |
||
35 | * @param \stdClass $jsonObject |
||
36 | * @return Year |
||
37 | */ |
||
38 | public static function fromJson(\stdClass $jsonObject): self |
||
42 | |||
43 | /** |
||
44 | * @return mixed |
||
45 | */ |
||
46 | public function getYearNumber(): int |
||
50 | |||
51 | /** |
||
52 | * @param Week $week |
||
53 | */ |
||
54 | public function addWeek(Week $week): void |
||
58 | |||
59 | /** |
||
60 | * @param int $weekNumber |
||
61 | * @return Week |
||
62 | */ |
||
63 | public function getWeek(int $weekNumber): Week |
||
71 | |||
72 | /** |
||
73 | * Retrieve an external iterator |
||
74 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
75 | * @return Traversable An instance of an object implementing <b>Iterator</b> or |
||
76 | * <b>Traversable</b> |
||
77 | * @since 5.0.0 |
||
78 | */ |
||
79 | public function getIterator(): Traversable |
||
83 | |||
84 | /** |
||
85 | * Specify data which should be serialized to JSON |
||
86 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
87 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
88 | * which is a value of any type other than a resource. |
||
89 | * @since 5.4.0 |
||
90 | */ |
||
91 | public function jsonSerialize(): array |
||
100 | } |