| Conditions | 2 |
| Paths | 2 |
| Total Lines | 28 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function process(Request $request, Handler $handler) : Response |
||
| 32 | { |
||
| 33 | $requestName = RequestTypes::getName($request->getType()); |
||
| 34 | |||
| 35 | $this->logger->debug("Starting handling request \"$requestName\"", [ |
||
| 36 | 'request' => $request, |
||
| 37 | ]); |
||
| 38 | |||
| 39 | $start = \microtime(true); |
||
| 40 | try { |
||
| 41 | $response = $handler->handle($request); |
||
| 42 | } catch (\Throwable $e) { |
||
| 43 | $this->logger->error("Request \"$requestName\" failed", [ |
||
| 44 | 'request' => $request, |
||
| 45 | 'exception' => $e, |
||
| 46 | 'duration_ms' => \round((\microtime(true) - $start) * 1000), |
||
| 47 | ]); |
||
| 48 | |||
| 49 | throw $e; |
||
| 50 | } |
||
| 51 | |||
| 52 | $this->logger->debug("Finished handling request \"$requestName\"", [ |
||
| 53 | 'request' => $request, |
||
| 54 | 'response' => $response, |
||
| 55 | 'duration_ms' => \round((\microtime(true) - $start) * 1000), |
||
| 56 | ]); |
||
| 57 | |||
| 58 | return $response; |
||
| 59 | } |
||
| 61 |