diff --git a/src/DTO/Company.php b/src/DTO/Company.php index 9f8a61b..771bef0 100644 --- a/src/DTO/Company.php +++ b/src/DTO/Company.php @@ -58,7 +58,7 @@ private static function slugify(string $value): string } /** - * @return array|float|int|string|string[]> + * @return array */ public function toArray(bool $rankByContributions): array { @@ -79,6 +79,17 @@ public function toArray(bool $rankByContributions): array 'avatar_url' => $this->avatarUrl, 'html_url' => $this->htmlUrl, 'contributors' => array_values(array_unique($this->contributors)), + 'employees' => array_map(function (Employee $employee): array { + return [ + 'login' => $employee->login, + 'time_frames' => array_map(function (TimeFrame $timeFrame): array { + return [ + 'start_date' => $timeFrame->startTime->format('Y-m-d'), + 'end_date' => $timeFrame->endTime?->format('Y-m-d'), + ]; + }, $employee->timeFrames), + ]; + }, $this->employees), ]; } }