| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 4.125 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 2 | public function shouldCache(ServerRequestInterface $request): bool |
|
| 14 | { |
||
| 15 | 2 | $routeResult = $request->getAttribute(RouteResult::class); |
|
| 16 | |||
| 17 | 2 | if (!$routeResult instanceof RouteResult) { |
|
| 18 | 2 | return false; |
|
| 19 | } |
||
| 20 | |||
| 21 | $matchedRoute = $routeResult->getMatchedRoute(); |
||
| 22 | |||
| 23 | if (!$matchedRoute instanceof Route) { |
||
| 24 | return false; |
||
| 25 | } |
||
| 26 | |||
| 27 | return in_array($matchedRoute->getName(), $this->getNames(), true); |
||
| 28 | } |
||
| 30 |