| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
| 20 | { |
||
| 21 | if (array_key_exists('id', $request->getQueryParams())) { |
||
| 22 | $legacyId = $request->getQueryParams()['id']; |
||
| 23 | |||
| 24 | if (!is_numeric($legacyId)) { |
||
| 25 | return new RedirectResponse('/login', 302); |
||
| 26 | } |
||
| 27 | |||
| 28 | $card = $this->cardRepository->getOneByLegacyId((int) $legacyId); |
||
| 29 | |||
| 30 | if (!$card) { |
||
| 31 | return new RedirectResponse('/login', 302); |
||
| 32 | } |
||
| 33 | |||
| 34 | $cardPath = '/card/' . $card->getId(); |
||
| 35 | |||
| 36 | return new RedirectResponse($cardPath, 302); |
||
| 37 | } |
||
| 38 | |||
| 39 | return new RedirectResponse('/login', 302); |
||
| 40 | } |
||
| 42 |