Conditions | 18 |
Paths | 22 |
Total Lines | 76 |
Code Lines | 46 |
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 |
||
19 | public function handle(): int |
||
20 | { |
||
21 | $guidArg = trim((string) $this->argument('guid')); |
||
22 | $idOpt = $this->option('id'); |
||
23 | |||
24 | if ($guidArg === '' && ($idOpt === null || $idOpt === '')) { |
||
25 | $this->error('You must supply either a GUID argument or --id=<release id>.'); |
||
26 | |||
27 | return 1; // missing identifier |
||
28 | } |
||
29 | |||
30 | if ($guidArg !== '' && $idOpt !== null && $idOpt !== '') { |
||
31 | $this->error('Provide only one identifier: GUID or --id, not both.'); |
||
32 | |||
33 | return 4; // conflicting identifiers |
||
34 | } |
||
35 | |||
36 | $release = null; |
||
37 | $guid = ''; |
||
38 | |||
39 | if ($idOpt !== null && $idOpt !== '') { |
||
40 | if (! ctype_digit((string) $idOpt)) { |
||
41 | $this->error('Release ID must be numeric.'); |
||
42 | |||
43 | return 5; // invalid id format |
||
44 | } |
||
45 | $release = Release::find((int) $idOpt); |
||
46 | if ($release === null) { |
||
47 | $this->error('Release not found for ID: '.$idOpt); |
||
48 | |||
49 | return 2; // not found |
||
50 | } |
||
51 | $guid = $release->guid; |
||
52 | } else { |
||
53 | $guid = $guidArg; |
||
54 | if ($guid === '') { // should not happen but guard |
||
55 | $this->error('GUID is required if --id not supplied.'); |
||
56 | |||
57 | return 1; |
||
58 | } |
||
59 | $release = Release::where('guid', $guid)->first(); |
||
60 | if ($release === null) { |
||
61 | $this->error('Release not found for GUID: '.$guid); |
||
62 | |||
63 | return 2; |
||
64 | } |
||
65 | } |
||
66 | |||
67 | if ($this->option('reset')) { |
||
68 | Release::where('id', $release->id)->update([ |
||
69 | 'passwordstatus' => -1, |
||
70 | 'haspreview' => -1, |
||
71 | 'jpgstatus' => 0, |
||
72 | 'videostatus' => 0, |
||
73 | 'audiostatus' => 0, |
||
74 | 'nfostatus' => -1, |
||
75 | ]); |
||
76 | $this->info('Reset postprocessing flags for release ID '.$release->id.' (GUID '.$guid.')'); |
||
77 | } |
||
78 | |||
79 | if ($this->option('no-progress')) { |
||
80 | config(['nntmux.echocli' => false]); |
||
81 | } |
||
82 | |||
83 | $processor = new ProcessAdditional; |
||
84 | $ok = $processor->processSingleGuid($guid); |
||
85 | |||
86 | if (! $ok) { |
||
87 | $this->error('Processing failed or nothing processed for '.($idOpt ? 'ID '.$idOpt : 'GUID '.$guid).'.'); |
||
88 | |||
89 | return 3; |
||
90 | } |
||
91 | |||
92 | $this->info('Additional postprocessing completed for '.($idOpt ? 'ID '.$idOpt : 'GUID '.$guid).'.'); |
||
93 | |||
94 | return 0; |
||
95 | } |
||
97 |
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