| Conditions | 5 |
| Paths | 2 |
| Total Lines | 55 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 36 | public function rebuild($idParent = 0, $left = 1, $depth = 0) |
||
| 37 | { |
||
| 38 | ini_set('xdebug.max_nesting_level', 10000); |
||
| 39 | ini_set('memory_limit', '-1'); |
||
| 40 | |||
| 41 | $result = $this->qb |
||
| 42 | ->table($this->table) |
||
| 43 | ->select('id') |
||
| 44 | ->where('id_parent', $idParent) |
||
| 45 | ->orderBy('id') |
||
| 46 | ->get(); |
||
| 47 | |||
| 48 | $right = $left + 1; |
||
| 49 | |||
| 50 | if ($result) { |
||
| 51 | $i = 0; |
||
| 52 | foreach ($result as $row) { |
||
| 53 | if ($i == 0) { |
||
| 54 | $this->qb |
||
| 55 | ->table($this->table) |
||
| 56 | ->where('id', $row->id) |
||
| 57 | ->update($update = [ |
||
| 58 | 'record_left' => $left, |
||
| 59 | 'record_right' => $right, |
||
| 60 | 'record_depth' => $depth, |
||
| 61 | ]); |
||
| 62 | } else { |
||
| 63 | $this->qb |
||
| 64 | ->table($this->table) |
||
| 65 | ->where('id', $row->id) |
||
| 66 | ->update($update = [ |
||
| 67 | 'record_left' => $left = $right + 1, |
||
| 68 | 'record_right' => $right = $left + 1, |
||
| 69 | 'record_depth' => $depth, |
||
| 70 | ]); |
||
| 71 | } |
||
| 72 | |||
| 73 | $update[ 'id' ] = $row->id; |
||
| 74 | |||
| 75 | if ($this->hasChild($row->id)) { |
||
| 76 | $right = $this->rebuild($row->id, $right, $depth + 1); |
||
| 77 | $this->qb |
||
| 78 | ->table($this->table) |
||
| 79 | ->where('id', $row->id) |
||
| 80 | ->update($update = [ |
||
| 81 | 'record_right' => $right, |
||
| 82 | ]); |
||
| 83 | $update[ 'id' ] = $row->id; |
||
| 84 | } |
||
| 85 | |||
| 86 | $i++; |
||
| 87 | } |
||
| 88 | } |
||
| 89 | |||
| 90 | return $right + 1; |
||
| 91 | } |
||
| 227 | } |
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