| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 25 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
||
| 26 | { |
||
| 27 | $response = $handler->handle($request); |
||
| 28 | |||
| 29 | if (! empty($body = $response->getBody()->getContents())) { |
||
| 30 | $benchmark = Services::timer(); |
||
| 31 | |||
| 32 | $output = str_replace( |
||
| 33 | [ |
||
| 34 | '{elapsed_time}', |
||
| 35 | '{memory_usage}', |
||
| 36 | ], |
||
| 37 | [ |
||
| 38 | (string) $benchmark->getElapsedTime('total_execution'), |
||
| 39 | number_format(memory_get_peak_usage() / 1024 / 1024, 3), |
||
| 40 | ], |
||
| 41 | $body |
||
| 42 | ); |
||
| 43 | |||
| 44 | $response = $response->withBody(to_stream($output)); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $response; |
||
|
|
|||
| 48 | } |
||
| 50 |