| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 16 | public function find(string $content): array |
|
| 21 | { |
||
| 22 | 16 | $texts = []; |
|
| 23 | 16 | foreach ($this->patterns as $pattern => $textPosition) { |
|
| 24 | 14 | if ($textPosition === null) { |
|
| 25 | 2 | $content = preg_replace($pattern, '', $content); |
|
| 26 | 2 | continue; |
|
| 27 | } |
||
| 28 | 14 | $texts = array_merge($texts, $this->findTexts($pattern, $content, $textPosition, $texts)); |
|
|
|
|||
| 29 | 14 | $content = preg_replace($pattern, '', $content); |
|
| 30 | 14 | } |
|
| 31 | 14 | return $texts; |
|
| 32 | 14 | } |
|
| 49 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.