Conditions | 5 |
Paths | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 5.9256 |
Changes | 0 |
1 | <?php |
||
37 | 4 | public function transform(ParameterBag $item) |
|
38 | { |
||
39 | 4 | $transformer = new EmptyValueToNullTransformer(); |
|
40 | |||
41 | // check for any default values that could be set |
||
42 | 4 | foreach ($this->defaultValues as $key => $value) { |
|
43 | // only set when it's not existing in the data or has no value |
||
44 | if (!$item->has($key) || null === $transformer->transform($item->get($key), $key, $item) || $this->overwrite) { |
||
|
|||
45 | $item->set($key, $value); |
||
46 | } |
||
47 | } |
||
48 | 4 | } |
|
49 | } |
||
50 |
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.