@@ -5,13 +5,11 @@ |
||
| 5 | 5 | use DateTimeImmutable; |
| 6 | 6 | use DateTimeInterface; |
| 7 | 7 | use Doctrine\DBAL\Connection; |
| 8 | -use Doctrine\DBAL\Driver\PDOStatement; |
|
| 9 | 8 | use Doctrine\DBAL\Statement; |
| 10 | 9 | use Doctrine\DBAL\Types\Type; |
| 11 | 10 | use Scheduler\Domain\Model\Shift\Shift; |
| 12 | 11 | use Scheduler\Domain\Model\Shift\ShiftMapper; |
| 13 | 12 | use Scheduler\Domain\Model\User\NullUser; |
| 14 | -use Scheduler\Domain\Model\User\User; |
|
| 15 | 13 | use Scheduler\Domain\Model\User\UserMapper; |
| 16 | 14 | |
| 17 | 15 | class DbalShiftMapper extends DbalMapper implements ShiftMapper |
@@ -176,7 +176,7 @@ |
||
| 176 | 176 | "phone" => $resultSet["e_phone"], |
| 177 | 177 | "created_at" => $resultSet["e_created_at"], |
| 178 | 178 | "updated_at" => $resultSet["e_updated_at"] |
| 179 | - ]) |
|
| 179 | + ]) |
|
| 180 | 180 | : new NullUser(); |
| 181 | 181 | |
| 182 | 182 | return new Shift($id, $manager, $employee, $break, $start, $end, $created, $updated); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $url = "/shifts/{$shift->getId()}"; |
| 18 | 18 | |
| 19 | 19 | $this->response = $this->response->withStatus(201) |
| 20 | - ->withHeader("Location", $url); |
|
| 20 | + ->withHeader("Location", $url); |
|
| 21 | 21 | $this->jsonBody($this->resource->item($shift)); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | protected function notAuthenticated() |
| 40 | 40 | { |
| 41 | 41 | $this->response = $this->response->withStatus(401) |
| 42 | - ->withHeader("WWW-Authenticate", "None"); |
|
| 42 | + ->withHeader("WWW-Authenticate", "None"); |
|
| 43 | 43 | |
| 44 | 44 | $problem = $this->createProblem(); |
| 45 | 45 | $problem->setDetail("This resource requires a valid access token."); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if ($shift === null) { |
| 61 | 61 | return $this->payload->setStatus(Payload::NOT_FOUND) |
| 62 | - ->setMessages(self::SHIFT_NOT_FOUND_MESSAGE); |
|
| 62 | + ->setMessages(self::SHIFT_NOT_FOUND_MESSAGE); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if ($employeeId !== null) { |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if ($employee instanceof NullUser) { |
| 69 | 69 | return $this->payload->setStatus(Payload::NOT_FOUND) |
| 70 | - ->setMessages(self::USER_NOT_FOUND_MESSAGE); |
|
| 70 | + ->setMessages(self::USER_NOT_FOUND_MESSAGE); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $shift = $shift->assignTo($employee); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $shift = $shift->changeStartTime($start) |
| 77 | - ->changeEndTime($end) |
|
| 78 | - ->changeBreak($break); |
|
| 77 | + ->changeEndTime($end) |
|
| 78 | + ->changeBreak($break); |
|
| 79 | 79 | |
| 80 | 80 | $this->shiftMapper->update($shift); |
| 81 | 81 | |
| 82 | 82 | return $this->payload->setStatus(Payload::UPDATED) |
| 83 | - ->setOutput($shift); |
|
| 83 | + ->setOutput($shift); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -53,6 +53,6 @@ |
||
| 53 | 53 | $shifts = $this->shiftMapper->findShiftsInTimePeriod($start, $end); |
| 54 | 54 | |
| 55 | 55 | return $this->payload->setStatus(Payload::SUCCESS) |
| 56 | - ->setOutput($shifts); |
|
| 56 | + ->setOutput($shifts); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | if (! is_integer($employeeId)) { |
| 29 | 29 | return $this->payload->setStatus(Payload::NOT_VALID) |
| 30 | - ->setMessages(["employee_id" => self::INVALID_ID_MESSAGE]); |
|
| 30 | + ->setMessages(["employee_id" => self::INVALID_ID_MESSAGE]); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if ($currentUser->getId() !== $employeeId) { |
@@ -37,6 +37,6 @@ discard block |
||
| 37 | 37 | $shifts = $this->shiftMapper->findShiftsByEmployeeId($currentUser->getId()); |
| 38 | 38 | |
| 39 | 39 | return $this->payload->setStatus(Payload::SUCCESS) |
| 40 | - ->setOutput($shifts); |
|
| 40 | + ->setOutput($shifts); |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return $this->payload->setStatus(Payload::SUCCESS) |
| 44 | - ->setOutput($shift); |
|
| 44 | + ->setOutput($shift); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -31,6 +31,6 @@ |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return $this->payload->setStatus(Payload::SUCCESS) |
| 34 | - ->setOutput($employee); |
|
| 34 | + ->setOutput($employee); |
|
| 35 | 35 | } |
| 36 | 36 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | if (count($invalid)) { |
| 48 | 48 | return $this->payload->setStatus(Payload::NOT_VALID) |
| 49 | - ->setMessages($invalid); |
|
| 49 | + ->setMessages($invalid); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $employee = new NullUser(); |