Conditions | 12 |
Paths | 16 |
Total Lines | 32 |
Code Lines | 24 |
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 |
||
19 | protected function buildTableName(?string $alias, $name): string { |
||
20 | if(is_object($name) && !($name instanceof VirtualTable) && method_exists($name, '__toString')) { |
||
21 | $name = (string) $name; |
||
22 | $lines = explode("\n", $name); |
||
23 | $lines = array_map(static fn(string $line) => "\t{$line}", $lines); |
||
24 | $name = implode("\n", $lines); |
||
25 | $name = '(' . trim(rtrim(trim($name), ';')) . ')'; |
||
26 | } |
||
27 | if(is_array($name)) { |
||
28 | $parts = []; |
||
29 | foreach($name as /*$index => */$bucket) { |
||
30 | if(is_scalar($bucket)/* && ctype_digit((string) $index)*/) { |
||
31 | $parts[] = "SELECT {$this->db()->quote($bucket)} AS {$this->db()->quoteField('value')}"; |
||
32 | } else { |
||
33 | $values = []; |
||
34 | foreach($bucket as $field => $value) { |
||
35 | $values[] = sprintf('%s AS %s', $this->db()->quote($value), $this->db()->quoteField($field)); |
||
36 | } |
||
37 | $parts[] = sprintf("SELECT %s", implode(', ', $values)); |
||
38 | } |
||
39 | } |
||
40 | $name = '(' . implode("\n\tUNION ALL\n\t", $parts) . ')'; |
||
41 | } |
||
42 | if((is_string($name) || $name instanceof VirtualTable) && $this->db()->getVirtualTables()->has($name)) { |
||
43 | $select = (string) $this->db()->getVirtualTables()->get($name); |
||
44 | $name = sprintf('(%s)', implode("\n\t", explode("\n", trim($select)))); |
||
45 | } |
||
46 | $name = $this->aliasReplacer()->replace((string) $name); |
||
47 | if($alias !== null) { |
||
48 | return sprintf("%s %s", $name, $alias); |
||
49 | } |
||
50 | return $name; |
||
51 | } |
||
58 |
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