month = (int)$data['month']; try { $calendarData->date = new DateTimeImmutable($data['date']); } catch (Exception $e) { throw new InvalidDateFormatException('Could not convert date: ' . $data['date']); } $calendarData->addressId = (int)$data['address_id']; $calendarData->employeeName = (string)$data['name']; $calendarData->type = (string)$data['type']; $calendarData->isHalf = (bool)$data['is_half']; return $calendarData; } /** * @return int */ public function getMonth(): int { return $this->month; } /** * @return DateTimeInterface */ public function getDate(): DateTimeInterface { return $this->date; } /** * @return int */ public function getAddressId(): int { return $this->addressId; } /** * @return string */ public function getEmployeeName(): string { return $this->employeeName; } /** * @return string */ public function getType(): string { return $this->type; } /** * @return bool */ public function isHalf(): bool { return $this->isHalf; } }