| Conditions | 3 |
| Paths | 32 |
| Total Lines | 60 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 48 | public function run(): void |
||
| 49 | { |
||
| 50 | $startTime = microtime(true); |
||
| 51 | |||
| 52 | // Register temporary error handler to catch error while container is building. |
||
| 53 | $errorHandler = $this->createTemporaryErrorHandler(); |
||
| 54 | $this->registerErrorHandler($errorHandler); |
||
| 55 | |||
| 56 | $config = new Config( |
||
| 57 | dirname(__DIR__, 2), |
||
| 58 | '/config/packages', // Configs path. |
||
| 59 | null, |
||
| 60 | [ |
||
| 61 | 'params', |
||
| 62 | 'events', |
||
| 63 | 'events-web', |
||
| 64 | 'events-console', |
||
| 65 | ], |
||
| 66 | ); |
||
| 67 | |||
| 68 | $container = new Container($config->get('web'), $config->get('providers-web')); |
||
| 69 | |||
| 70 | // Register error handler with real container-configured dependencies. |
||
| 71 | $this->registerErrorHandler($container->get(ErrorHandler::class), $errorHandler); |
||
| 72 | |||
| 73 | // Run bootstrap |
||
| 74 | $this->runBootstrap($container, $config->get('bootstrap-web')); |
||
| 75 | |||
| 76 | $container = $container->get(ContainerInterface::class); |
||
| 77 | |||
| 78 | if ($this->debug) { |
||
| 79 | /** @psalm-suppress MixedMethodCall */ |
||
| 80 | $container->get(ListenerConfigurationChecker::class)->check($config->get('events-web')); |
||
| 81 | } |
||
| 82 | |||
| 83 | /** @var Application */ |
||
| 84 | $application = $container->get(Application::class); |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @var ServerRequestInterface |
||
| 88 | * @psalm-suppress MixedMethodCall |
||
| 89 | */ |
||
| 90 | $serverRequest = $container->get(ServerRequestFactory::class)->createFromGlobals(); |
||
| 91 | $request = $serverRequest->withAttribute('applicationStartTime', $startTime); |
||
| 92 | |||
| 93 | try { |
||
| 94 | $application->start(); |
||
| 95 | $response = $application->handle($request); |
||
| 96 | $this->emit($request, $response); |
||
| 97 | } catch (Throwable $throwable) { |
||
| 98 | $handler = new ThrowableHandler($throwable); |
||
| 99 | /** |
||
| 100 | * @var ResponseInterface |
||
| 101 | * @psalm-suppress MixedMethodCall |
||
| 102 | */ |
||
| 103 | $response = $container->get(ErrorCatcher::class)->process($request, $handler); |
||
| 104 | $this->emit($request, $response); |
||
| 105 | } finally { |
||
| 106 | $application->afterEmit($response ?? null); |
||
| 107 | $application->shutdown(); |
||
| 108 | } |
||
| 146 |
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