Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function __invoke($currentUser, $shiftId, $withCoworkers) |
||
26 | { |
||
27 | if (! $currentUser->isAuthenticated()) { |
||
28 | return $this->payload->setStatus(Payload::NOT_AUTHENTICATED); |
||
29 | } |
||
30 | |||
31 | $shift = $this->shiftMapper->find($shiftId); |
||
32 | |||
33 | if ($shift === null) { |
||
34 | return $this->payload->setStatus(Payload::NOT_FOUND); |
||
35 | } |
||
36 | |||
37 | if ($withCoworkers) { |
||
38 | $shift = $shift->withCoworkers( |
||
39 | $this->shiftCoworkersFinder->findCoworkersForShift($shift) |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | return $this->payload->setStatus(Payload::SUCCESS) |
||
44 | ->setOutput($shift); |
||
45 | } |
||
46 | } |
||
47 |