| Conditions | 1 |
| Paths | 1 |
| Total Lines | 75 |
| Code Lines | 43 |
| 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 |
||
| 31 | public function register(): void |
||
| 32 | { |
||
| 33 | // Configuration is a singleton since it loads settings once |
||
| 34 | $this->app->singleton(ProcessingConfiguration::class, function () { |
||
| 35 | return new ProcessingConfiguration(); |
||
| 36 | }); |
||
| 37 | |||
| 38 | // Console output service |
||
| 39 | $this->app->singleton(ConsoleOutputService::class, function ($app) { |
||
| 40 | $config = $app->make(ProcessingConfiguration::class); |
||
| 41 | return new ConsoleOutputService($config->echoCLI); |
||
| 42 | }); |
||
| 43 | |||
| 44 | // NZB content parser |
||
| 45 | $this->app->singleton(NzbContentParser::class, function ($app) { |
||
| 46 | $config = $app->make(ProcessingConfiguration::class); |
||
| 47 | return new NzbContentParser( |
||
| 48 | new NZB(), |
||
| 49 | $config->debugMode, |
||
| 50 | $config->echoCLI |
||
| 51 | ); |
||
| 52 | }); |
||
| 53 | |||
| 54 | // Archive extraction service |
||
| 55 | $this->app->singleton(ArchiveExtractionService::class, function ($app) { |
||
| 56 | return new ArchiveExtractionService( |
||
| 57 | $app->make(ProcessingConfiguration::class) |
||
| 58 | ); |
||
| 59 | }); |
||
| 60 | |||
| 61 | // Usenet download service |
||
| 62 | $this->app->singleton(UsenetDownloadService::class, function ($app) { |
||
| 63 | return new UsenetDownloadService( |
||
| 64 | $app->make(ProcessingConfiguration::class) |
||
| 65 | ); |
||
| 66 | }); |
||
| 67 | |||
| 68 | // Release file manager |
||
| 69 | $this->app->singleton(ReleaseFileManager::class, function ($app) { |
||
| 70 | return new ReleaseFileManager( |
||
| 71 | $app->make(ProcessingConfiguration::class), |
||
| 72 | new ReleaseExtra(), |
||
| 73 | new ReleaseImage(), |
||
| 74 | new Nfo(), |
||
| 75 | new NZB(), |
||
| 76 | new NameFixer() |
||
| 77 | ); |
||
| 78 | }); |
||
| 79 | |||
| 80 | // Media extraction service |
||
| 81 | $this->app->singleton(MediaExtractionService::class, function ($app) { |
||
| 82 | return new MediaExtractionService( |
||
| 83 | $app->make(ProcessingConfiguration::class), |
||
| 84 | new ReleaseImage(), |
||
| 85 | new ReleaseExtra(), |
||
| 86 | new CategorizationService() |
||
| 87 | ); |
||
| 88 | }); |
||
| 89 | |||
| 90 | // Temp workspace service (might already be registered elsewhere) |
||
| 91 | $this->app->singleton(TempWorkspaceService::class, function () { |
||
| 92 | return new TempWorkspaceService(); |
||
| 93 | }); |
||
| 94 | |||
| 95 | // Main orchestrator |
||
| 96 | $this->app->singleton(AdditionalProcessingOrchestrator::class, function ($app) { |
||
| 97 | return new AdditionalProcessingOrchestrator( |
||
| 98 | $app->make(ProcessingConfiguration::class), |
||
| 99 | $app->make(NzbContentParser::class), |
||
| 100 | $app->make(ArchiveExtractionService::class), |
||
| 101 | $app->make(MediaExtractionService::class), |
||
| 102 | $app->make(UsenetDownloadService::class), |
||
| 103 | $app->make(ReleaseFileManager::class), |
||
| 104 | $app->make(TempWorkspaceService::class), |
||
| 105 | $app->make(ConsoleOutputService::class) |
||
| 106 | ); |
||
| 119 |
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