| Conditions | 3 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function __invoke(Request $request) : JsonResponse |
||
| 33 | { |
||
| 34 | $confirmationToken = $request->query->get('confirmation-token'); |
||
| 35 | if (null === $confirmationToken) { |
||
| 36 | return new JsonResponse(null, 404); |
||
| 37 | } |
||
| 38 | |||
| 39 | try { |
||
| 40 | $this->commandBus->handle( |
||
| 41 | new EnableUserCommand($confirmationToken) |
||
| 42 | ); |
||
| 43 | |||
| 44 | return new JsonResponse(); |
||
| 45 | } catch (UserTokenNotFoundException $exception) { |
||
| 46 | return new JsonResponse( |
||
| 47 | sprintf( |
||
| 48 | 'The "%s" confirmation token does not exist', |
||
| 49 | $confirmationToken |
||
| 50 | ), |
||
| 51 | 400 |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | } |
||
| 56 |