Conditions | 5 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function getValue($object) |
||
20 | { |
||
21 | if (!$this->hasIds()) { |
||
22 | throw new \RuntimeException("transfer " . get_class($object) . " has no id mapping"); |
||
23 | } |
||
24 | |||
25 | if ($this->isMultiId()) { |
||
26 | $values = []; |
||
27 | |||
28 | foreach ($this->ids as $idMetadata) { |
||
29 | $value = $idMetadata->getValue($object); |
||
30 | |||
31 | if (!$value) { |
||
32 | continue; |
||
33 | } |
||
34 | |||
35 | $values[] = sprintf('%s=%s', $idMetadata->name, $idMetadata->getValue($object)); |
||
36 | } |
||
37 | |||
38 | return implode(';', $values); |
||
39 | } |
||
40 | |||
41 | return $this->ids[0]->getValue($object); |
||
42 | } |
||
81 | } |
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.