| Conditions | 3 |
| Paths | 0 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
||
| 26 | { |
||
| 27 | $response = $handler->handle($request); |
||
| 28 | |||
| 29 | $ip = $this->getClientIp($request); |
||
| 30 | $email = $this->getEmail($request); |
||
| 31 | |||
| 32 | try { |
||
| 33 | $this->accessLogger->log( |
||
| 34 | $response->getStatusCode() === 200 ? AccessLogger::TYPE_LOGIN_SUCCESS : |
||
| 35 | AccessLogger::TYPE_LOGIN_FAILURE, |
||
| 36 | $email, |
||
| 37 | $ip |
||
| 38 | ); |
||
| 39 | } catch (\Throwable $e) { |
||
| 40 | // Discard any error |
||
| 41 | error_log('AccessLoggerMiddleware failure' . $e->getMessage()); |
||
| 42 | } finally { |
||
| 43 | return $response; |
||
| 44 | } |
||
| 61 |