Conditions | 7 |
Paths | 12 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 0 |
1 | <?php |
||
17 | public function addColumn($name, $content = null, $order = false) |
||
18 | { |
||
19 | if (is_bool($content) || is_int($content)) { |
||
20 | $order = $content; |
||
21 | $content = null; |
||
22 | } |
||
23 | |||
24 | if (is_null($content) && is_string($name)) { |
||
25 | $content = function ($model) use ($name) { |
||
26 | return $model->{$name}; |
||
27 | }; |
||
28 | } |
||
29 | |||
30 | if (is_array($name)) { |
||
31 | foreach ($name as $n) { |
||
32 | $this->addColumn($n, $content, $order); |
||
33 | } |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | return parent::addColumn($name, $content, $order); |
||
1 ignored issue
–
show
|
|||
39 | } |
||
40 | } |
||
41 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.