Conditions | 5 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5.0144 |
Changes | 0 |
1 | <?php |
||
19 | 26 | public function getValue($object) |
|
20 | { |
||
21 | 26 | if (!$this->hasIds()) { |
|
22 | throw new \RuntimeException("transfer " . get_class($object) . " has no id mapping"); |
||
23 | } |
||
24 | |||
25 | 26 | if ($this->isMultiId()) { |
|
26 | 2 | $values = []; |
|
27 | |||
28 | 2 | foreach ($this->ids as $idMetadata) { |
|
29 | 2 | $value = $idMetadata->getValue($object); |
|
30 | |||
31 | 2 | if (!$value) { |
|
32 | 1 | continue; |
|
33 | } |
||
34 | |||
35 | 2 | $values[] = sprintf('%s=%s', $idMetadata->name, $idMetadata->getValue($object)); |
|
36 | } |
||
37 | |||
38 | 2 | return implode(';', $values); |
|
39 | } |
||
40 | |||
41 | 25 | return $this->ids[0]->getValue($object); |
|
42 | } |
||
86 | } |
This check compares calls to functions or methods with their respective definitions. If the call has less 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.