year = $year; } /** * @return string */ public function getYear() { return $this->year; } /** * @param Month $month * @return $this */ public function setMonth(Month $month) { $this->months[(int) $month->getMonth()] = $month; return $this; } /** * @param int $month * @return null|Month */ public function getMonth(int $month) { if (isset($this->months[$month])) { return $this->months[$month]; } return null; } /** * @return Month[] */ public function getMonths() { return array_values($this->months); } }