Conditions | 17 |
Paths | 648 |
Total Lines | 56 |
Code Lines | 37 |
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 |
||
57 | public function SourceRecords() |
||
58 | { |
||
59 | $reqVars = Controller::curr()->request->requestVars(); |
||
60 | $importID = !empty($reqVars['filters']) ? $reqVars['filters']['ImportID'] : 1; |
||
61 | $list = singleton(FailedURLRewriteObject::class)->getBadImportData($importID); |
||
62 | $_list = ArrayList::create(); |
||
63 | $countNotImported = $countJunk = $countThirdParty = $countBadScheme = []; |
||
64 | foreach ($list as $badLink) { |
||
65 | if ($badLink->BadLinkType == 'NotImported') { |
||
66 | // Prevent same page showing in the report and "sum" the totals |
||
67 | if (empty($countNotImported[$badLink->ContainedInID])) { |
||
68 | $countNotImported[$badLink->ContainedInID] = 1; |
||
69 | } else { |
||
70 | $countNotImported[$badLink->ContainedInID] += 1; |
||
71 | } |
||
72 | continue; |
||
73 | } |
||
74 | if ($badLink->BadLinkType == 'ThirdParty') { |
||
75 | // Prevent same page showing in the report and "sum" the totals |
||
76 | if (empty($countThirdParty[$badLink->ContainedInID])) { |
||
77 | $countThirdParty[$badLink->ContainedInID] = 1; |
||
78 | } else { |
||
79 | $countThirdParty[$badLink->ContainedInID] += 1; |
||
80 | } |
||
81 | } |
||
82 | if ($badLink->BadLinkType == 'BadScheme') { |
||
83 | // Prevent same page showing in the report and "sum" the totals |
||
84 | if (empty($countBadScheme[$badLink->ContainedInID])) { |
||
85 | $countBadScheme[$badLink->ContainedInID] = 1; |
||
86 | } else { |
||
87 | $countBadScheme[$badLink->ContainedInID] += 1; |
||
88 | } |
||
89 | continue; |
||
90 | } |
||
91 | if ($badLink->BadLinkType == 'Junk') { |
||
92 | // Prevent same page showing in the report and "sum" the totals |
||
93 | if (empty($countJunk[$badLink->ContainedInID])) { |
||
94 | $countJunk[$badLink->ContainedInID] = 1; |
||
95 | } else { |
||
96 | $countJunk[$badLink->ContainedInID] += 1; |
||
97 | } |
||
98 | continue; |
||
99 | } |
||
100 | } |
||
101 | |||
102 | foreach ($list as $item) { |
||
103 | // Only push new items if not already in the list |
||
104 | if (!$_list->find('ContainedInID', $item->ContainedInID)) { |
||
105 | $item->ThirdPartyTotal = isset($countThirdParty[$item->ContainedInID]) ? $countThirdParty[$item->ContainedInID] : 0; |
||
106 | $item->BadSchemeTotal = isset($countBadScheme[$item->ContainedInID]) ? $countBadScheme[$item->ContainedInID] : 0; |
||
107 | $item->NotImportedTotal = isset($countNotImported[$item->ContainedInID]) ? $countNotImported[$item->ContainedInID] : 0; |
||
108 | $item->JunkTotal = isset($countJunk[$item->ContainedInID]) ? $countJunk[$item->ContainedInID] : 0; |
||
109 | $_list->push($item); |
||
110 | } |
||
111 | } |
||
112 | return $_list; |
||
113 | } |
||
231 |
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