Conditions | 6 |
Paths | 9 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 6.1666 |
Changes | 0 |
1 | <?php |
||
26 | 19 | protected function isVisible($item) |
|
27 | { |
||
28 | 19 | if (! isset($item['can'])) { |
|
29 | 17 | return true; |
|
30 | } |
||
31 | |||
32 | 2 | $args = []; |
|
33 | |||
34 | if (isset($item['model'])) { |
||
35 | $args = $item['model']; |
||
36 | 2 | } |
|
37 | |||
38 | if (! is_array($item['can'])) { |
||
39 | return $this->gate->allows($item['can'], $args); |
||
40 | } |
||
41 | |||
42 | foreach ($item['can'] as $can) { |
||
43 | if ($this->gate->allows($can, $args)) { |
||
44 | return true; |
||
45 | } |
||
46 | } |
||
47 | |||
48 | return false; |
||
49 | } |
||
50 | } |
||
51 |