Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function __invoke(User $currentUser, $employeeId) |
||
23 | { |
||
24 | if (! $currentUser->isAuthenticated()) { |
||
25 | return $this->payload->setStatus(Payload::NOT_AUTHENTICATED); |
||
26 | } |
||
27 | |||
28 | if (! is_integer($employeeId)) { |
||
29 | return $this->payload->setStatus(Payload::NOT_VALID) |
||
30 | ->setMessages(["employee_id" => self::INVALID_ID_MESSAGE]); |
||
31 | } |
||
32 | |||
33 | if ($currentUser->getId() !== $employeeId) { |
||
34 | return $this->payload->setStatus(Payload::NOT_AUTHORIZED); |
||
35 | } |
||
36 | |||
37 | $shifts = $this->shiftMapper->findShiftsByEmployeeId($currentUser->getId()); |
||
38 | |||
39 | return $this->payload->setStatus(Payload::SUCCESS) |
||
40 | ->setOutput($shifts); |
||
41 | } |
||
42 | } |
||
43 |