Conditions | 4 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
56 | public function execute($repository, $pAPINumber = 1) |
||
57 | { |
||
58 | if (! $repository instanceof Record && ! $repository instanceof Story) { |
||
59 | throw new \InvalidArgumentException('Invalid repository type (story or record required).'); |
||
60 | } |
||
61 | |||
62 | $result = $repository->search($this->query, $pAPINumber); |
||
63 | |||
64 | if ($this->type == 1) { |
||
65 | return $result->getResults()->getStories(); |
||
66 | } |
||
67 | |||
68 | return $result->getResults()->getRecords(); |
||
69 | } |
||
70 | } |
||
71 |
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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.