| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 |
||
| 34 | public function boot(Container $container) |
||
| 35 | { |
||
| 36 | // |
||
| 37 | // Register RoadRunner Environment |
||
| 38 | // |
||
| 39 | $environmentRegistrar = static function (GlobalEnvironmentInterface $env): EnvironmentInterface { |
||
| 40 | return new Environment($env->getAll()); |
||
| 41 | }; |
||
| 42 | |||
| 43 | $container->bindSingleton(EnvironmentInterface::class, $environmentRegistrar); |
||
| 44 | $container->bindSingleton(Environment::class, $environmentRegistrar); |
||
| 45 | |||
| 46 | // |
||
| 47 | // Register RPC |
||
| 48 | // |
||
| 49 | $rpcRegistrar = static function (EnvironmentInterface $env): RPCInterface { |
||
| 50 | return RPC::create($env->getRPCAddress()); |
||
| 51 | }; |
||
| 52 | |||
| 53 | $container->bindSingleton(RPCInterface::class, $rpcRegistrar); |
||
| 54 | $container->bindSingleton(RPC::class, $rpcRegistrar); |
||
| 55 | |||
| 56 | // |
||
| 57 | // Register Worker |
||
| 58 | // |
||
| 59 | $workerRegistrar = static function (EnvironmentInterface $env): WorkerInterface { |
||
| 60 | return Worker::createFromEnvironment($env); |
||
| 61 | }; |
||
| 62 | |||
| 63 | $container->bindSingleton(WorkerInterface::class, $workerRegistrar); |
||
| 64 | $container->bindSingleton(Worker::class, $workerRegistrar); |
||
| 65 | |||
| 66 | // |
||
| 67 | // Register PSR Worker |
||
| 68 | // |
||
| 69 | $registrar = static function ( |
||
| 70 | WorkerInterface $worker, |
||
| 71 | ServerRequestFactory $requests, |
||
| 72 | StreamFactory $streams, |
||
| 73 | UploadedFileFactory $uploads |
||
| 74 | ): PSR7WorkerInterface { |
||
| 75 | return new PSR7Worker( |
||
| 76 | $worker, |
||
| 77 | $requests, |
||
| 78 | $streams, |
||
| 79 | $uploads |
||
| 80 | ); |
||
| 81 | }; |
||
| 82 | |||
| 83 | $container->bindSingleton(PSR7WorkerInterface::class, $registrar); |
||
| 84 | $container->bindSingleton(PSR7Worker::class, $registrar); |
||
| 85 | } |
||
| 87 |
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