| Conditions | 10 |
| Paths | 3 |
| Total Lines | 38 |
| Code Lines | 27 |
| 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 |
||
| 11 | public function getNextPlaceholder(int|null &$position = null): string|null |
||
| 12 | { |
||
| 13 | $result = null; |
||
| 14 | $length = $this->length - 1; |
||
| 15 | |||
| 16 | while ($this->position < $length) { |
||
| 17 | $pos = $this->position++; |
||
| 18 | |||
| 19 | match ($this->sql[$pos]) { |
||
| 20 | ':' => ($word = $this->parseWord()) === '' |
||
| 21 | ? $this->skipChars(':') |
||
| 22 | : $result = ':' . $word, |
||
| 23 | '"', "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), |
||
| 24 | 'e', 'E' => $this->sql[$this->position] === "'" |
||
| 25 | ? ++$this->position && $this->skipQuotedWithEscape("'") |
||
| 26 | : $this->skipIdentifier(), |
||
| 27 | '$' => $this->skipQuotedWithDollar(), |
||
| 28 | '-' => $this->sql[$this->position] === '-' |
||
| 29 | ? ++$this->position && $this->skipToAfterChar("\n") |
||
| 30 | : null, |
||
| 31 | '/' => $this->sql[$this->position] === '*' |
||
| 32 | ? ++$this->position && $this->skipToAfterString('*/') |
||
| 33 | : null, |
||
| 34 | // Identifiers can contain dollar sign which can be used for quoting. Skip them. |
||
| 35 | '_','a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', |
||
| 36 | 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', |
||
| 37 | 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' => $this->skipIdentifier(), |
||
| 38 | default => null, |
||
| 39 | }; |
||
| 40 | |||
| 41 | if ($result !== null) { |
||
| 42 | $position = $pos; |
||
| 43 | |||
| 44 | return $result; |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return null; |
||
| 49 | } |
||
| 88 |
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