Conditions | 14 |
Paths | 112 |
Total Lines | 52 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
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 |
||
66 | public function run($request) |
||
67 | { |
||
68 | $classes = $this->getAllVersionedDataClasses(); |
||
69 | if ($request && $request->requestVar('verbose')) { |
||
70 | $this->verbose = $request->requestVar('verbose'); |
||
71 | } |
||
72 | |||
73 | if ($request && $request->requestVar('dry')) { |
||
74 | $this->dryRun = $request->requestVar('dry'); |
||
75 | } |
||
76 | |||
77 | if ($request && $request->requestVar('limit')) { |
||
78 | $this->limit = $request->requestVar('limit'); |
||
79 | } |
||
80 | |||
81 | DB::alteration_message('Pruning all DataObjects with a maximum of ' . self::MAX_ITEMS_PER_CLASS . ' per class.'); |
||
82 | $totalTotalDeleted = 0; |
||
83 | $runObject = RunForOneObject::inst() |
||
84 | ->setVerbose($this->verbose) |
||
85 | ->setDryRun($this->dryRun) |
||
86 | ; |
||
87 | DB::alteration_message('settings (set as parameters)'); |
||
88 | DB::alteration_message('-------------------- '); |
||
89 | DB::alteration_message('verbose: ' . ($this->verbose ? 'yes' : 'no'), 'created'); |
||
90 | DB::alteration_message('dry run: ' . ($this->dryRun ? 'yes' : 'no'), 'created'); |
||
91 | DB::alteration_message('limit per class: ' . $this->limit, 'created'); |
||
92 | DB::alteration_message('-------------------- '); |
||
93 | foreach ($classes as $className) { |
||
94 | DB::alteration_message('... Looking at ' . $className); |
||
95 | $objects = $this->getObjectsPerClassName($runObject, $className); |
||
96 | $totalDeleted = 0; |
||
97 | |||
98 | foreach ($objects as $object) { |
||
99 | // check if stages are present |
||
100 | if($this->verbose) { |
||
101 | DB::alteration_message('... ... Checking #ID: ' . $object->ID); |
||
102 | } |
||
103 | $totalDeleted += $runObject->deleteSuperfluousVersions($object); |
||
104 | } |
||
105 | |||
106 | if ($totalDeleted > 0) { |
||
107 | DB::alteration_message('... ... Deleted ' . $totalDeleted . ' version records'); |
||
108 | $totalTotalDeleted += $totalDeleted; |
||
109 | } |
||
110 | } |
||
111 | |||
112 | DB::alteration_message('-------------------- '); |
||
113 | DB::alteration_message('Completed, pruned ' . $totalTotalDeleted . ' version records'); |
||
114 | DB::alteration_message('-------------------- '); |
||
115 | $array = $runObject->getCountRegister(); |
||
116 | foreach ($array as $table => $count) { |
||
117 | DB::alteration_message('... '.$table . ' has ' . $count . ' version records left.'); |
||
118 | } |
||
183 |
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