| Conditions | 14 |
| Paths | 17 |
| Total Lines | 35 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 21 | protected function buildTableName(?string $alias, $name): string { |
||
| 22 | if($name instanceof SpecialTable) { |
||
| 23 | $name = $name->asString($this->db()); |
||
| 24 | } elseif(is_object($name) && !($name instanceof VirtualTable) && method_exists($name, '__toString')) { |
||
| 25 | $name = (string) $name; |
||
| 26 | $lines = explode("\n", $name); |
||
| 27 | $lines = array_map(static fn(string $line) => "\t{$line}", $lines); |
||
| 28 | $name = implode("\n", $lines); |
||
| 29 | $name = '(' . trim(rtrim(trim($name), ';')) . ')'; |
||
| 30 | } elseif(is_array($name)) { |
||
| 31 | $parts = []; |
||
| 32 | foreach($name as /*$index => */$bucket) { |
||
| 33 | if(is_scalar($bucket)/* && ctype_digit((string) $index)*/) { |
||
| 34 | $parts[] = "SELECT {$this->db()->quote($bucket)} AS {$this->db()->quoteField('value')}"; |
||
| 35 | } elseif(is_iterable($bucket)) { |
||
| 36 | $values = []; |
||
| 37 | foreach($bucket as $field => $value) { |
||
| 38 | $values[] = sprintf('%s AS %s', $this->db()->quote($value), $this->db()->quoteField($field)); |
||
| 39 | } |
||
| 40 | $parts[] = sprintf("SELECT %s", implode(', ', $values)); |
||
| 41 | } else { |
||
| 42 | throw new InvalidArgumentException('Only scalar values and iterables are supported as table data'); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | $name = '(' . implode("\n\tUNION ALL\n\t", $parts) . ')'; |
||
| 46 | } |
||
| 47 | if((is_string($name) || $name instanceof VirtualTable) && $this->db()->getVirtualTables()->has($name)) { |
||
| 48 | $select = (string) $this->db()->getVirtualTables()->get($name); |
||
| 49 | $name = sprintf('(%s)', implode("\n\t", explode("\n", trim($select)))); |
||
| 50 | } |
||
| 51 | $name = $this->aliasReplacer()->replace((string) $name); |
||
| 52 | if($alias !== null) { |
||
| 53 | return sprintf("%s %s", $name, $alias); |
||
| 54 | } |
||
| 55 | return $name; |
||
| 56 | } |
||
| 63 |
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