Lines
87.50%
7 / 8
Methods
0.00%
0 / 1
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __invoke | 87.50% | 7 / 8 | 0.00% | 0 / 1 | 3.02 | ||
| 10 | class Profiler | |
| 11 | { | |
| 12 | /** | |
| 13 | * | |
| 14 | */ | |
| 15 | public function __invoke(ServerRequestInterface $request, ?RequestHandlerInterface $next): ResponseInterface | |
| 16 | { | |
| 17 | \BO\Slim\Profiler::add("Routing"); | |
| 18 | if (null !== $next) { | |
| 19 | $response = $next->handle($request); | |
| 20 | } else { | |
| 21 | $response = (new ResponseFactory())->createResponse(); | |
| 22 | } | |
| 23 | ||
| 24 | /** @psalm-suppress TypeDoesNotContainType Module App subclasses may set DEBUG to true. */ | |
| 25 | if (\App::DEBUG) { | |
| 26 | \BO\Slim\Profiler::addMemoryPeak(); | |
| 27 | $response = $response->withAddedHeader('X-Profiling', \BO\Slim\Profiler::getList()); | |
| 28 | } | |
| 29 | ||
| 30 | return $response; | |
| 31 | } | |
| 32 | } |