| Conditions | 6 |
| Paths | 7 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 6.0852 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | 3 | protected function buildRouter(ServerRequestInterface $request): Router |
|
| 44 | { |
||
| 45 | 3 | if (true === $this->cacheEnabled && file_exists($this->cacheFile)) { |
|
| 46 | 3 | $cache = file_get_contents($this->cacheFile); |
|
| 47 | 3 | $router = u($cache, ['allowed_classes' => true]); |
|
| 48 | |||
| 49 | 3 | if ($router instanceof Router) { |
|
| 50 | 3 | return $router; |
|
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | 3 | $builder = $this->builder; |
|
| 55 | 3 | $router = $builder(new Router()); |
|
| 56 | |||
| 57 | 3 | if (false === $this->cacheEnabled) { |
|
| 58 | return $router; |
||
| 59 | } |
||
| 60 | |||
| 61 | 3 | if ($router instanceof Router) { |
|
| 62 | 3 | $router->prepareRoutes($request); |
|
| 63 | 3 | file_put_contents($this->cacheFile, s($router)); |
|
| 64 | 3 | return $router; |
|
| 65 | } |
||
| 66 | |||
| 67 | throw new InvalidArgumentException('Invalid Router builder provided to cached router'); |
||
| 68 | } |
||
| 70 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths