| Conditions | 4 |
| Paths | 1 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 28 | 1 | public function __invoke(ServerRequestInterface $request, callable $next) |
|
| 29 | { |
||
| 30 | 1 | $this->current++; |
|
| 31 | 1 | $start = \microtime(true); |
|
| 32 | |||
| 33 | return resolve($next($request))->always(function () use ($start): void { |
||
| 34 | 1 | $took = \microtime(true) - $start; |
|
| 35 | 1 | $this->current--; |
|
| 36 | 1 | $this->total++; |
|
| 37 | 1 | $this->tookTotal += $took; |
|
| 38 | |||
| 39 | 1 | if ($this->tookMin === null || $took < $this->tookMin) { |
|
| 40 | 1 | $this->tookMin = $took; |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | if ($this->tookMax < $took) { |
|
| 44 | 1 | $this->tookMax = $took; |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | $this->tookAvg = $this->tookTotal / $this->total; |
|
| 48 | 1 | }); |
|
| 49 | } |
||
| 50 | |||
| 72 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.