| Conditions | 10 |
| Paths | 76 |
| Total Lines | 44 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 92 | protected function removeFiles($request, $go = false) |
||
| 93 | { |
||
| 94 | $conn = DB::get_conn(); |
||
| 95 | $schema = DB::get_schema(); |
||
| 96 | $dataObjectSchema = DataObject::getSchema(); |
||
| 97 | $tableList = $schema->tableList(); |
||
| 98 | |||
| 99 | $files = File::get(); |
||
| 100 | |||
| 101 | if ($go) { |
||
| 102 | $conn->transactionStart(); |
||
| 103 | } |
||
| 104 | |||
| 105 | $i = 0; |
||
| 106 | |||
| 107 | /** @var File $file */ |
||
| 108 | foreach ($files as $file) { |
||
| 109 | $path = self::getFullPath($file); |
||
| 110 | if (!trim($file->getRelativePath(), '/')) { |
||
| 111 | $this->message("#{$file->ID}: path is empty"); |
||
| 112 | if ($go) { |
||
| 113 | // $file->delete(); |
||
| 114 | self::deleteFile($file->ID); |
||
| 115 | $i++; |
||
| 116 | } |
||
| 117 | } |
||
| 118 | if (!file_exists($path)) { |
||
| 119 | $this->message("#{$file->ID}: $path does not exist"); |
||
| 120 | if ($go) { |
||
| 121 | // $file->delete(); |
||
| 122 | self::deleteFile($file->ID); |
||
| 123 | $i++; |
||
| 124 | } |
||
| 125 | } else { |
||
| 126 | $this->message("#{$file->ID}: $path is valid", "success"); |
||
| 127 | } |
||
| 128 | if ($go && $i % 100 == 0) { |
||
| 129 | $conn->transactionEnd(); |
||
| 130 | $conn->transactionStart(); |
||
| 131 | } |
||
| 132 | } |
||
| 133 | |||
| 134 | if ($go) { |
||
| 135 | $conn->transactionEnd(); |
||
| 136 | } |
||
| 175 |
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