Conditions | 7 |
Paths | 9 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 7.2269 |
Changes | 0 |
1 | <?php |
||
33 | 8 | public function isGranted(Feature $feature) |
|
34 | { |
||
35 | 8 | if (null === $this->context) { |
|
36 | return false; |
||
37 | } |
||
38 | |||
39 | 8 | if (!$feature->isEnabled()) { |
|
40 | 2 | return false; |
|
41 | } |
||
42 | |||
43 | 6 | if ($feature->getRole()) { |
|
44 | 4 | if (!$this->context->isGranted($feature->getRole())) { |
|
45 | return false; |
||
46 | } |
||
47 | } |
||
48 | |||
49 | 6 | if ('' !== trim($feature->getParentRole())) { |
|
50 | 2 | if (!$this->context->isGranted($feature->getParentRole())) { |
|
51 | 2 | return false; |
|
52 | } |
||
53 | } |
||
54 | |||
55 | 4 | return true; |
|
56 | } |
||
57 | } |
||
58 |