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