db = $db; } /** * @param $year * * @throws InvalidDateFormatException * * @return array|HolidayData[] */ public function findHolidayDataByYear(int $year): array { $sql = 'SELECT af.bezeichnung as `name`, af.datum as `date` FROM `arbeitsfreietage` AS `af` WHERE af.datum >= :first_date_of_year AND af.typ = \'feiertag\' ORDER BY af.datum'; $holidays = $this->db->fetchAll($sql, ['first_date_of_year' => $year . '-01-01']); $holidayData = []; if (!empty($holidays)) { foreach ($holidays as $holiday) { $holidayData[] = HolidayData::fromDbState($holiday); } } return $holidayData; } }