| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 33 | public function decide($feature, $user = null, $defaultIfNotFound = false) |
|
| 14 | { |
||
| 15 | 33 | if (! $this->featureExists($feature)) { |
|
| 16 | 2 | return $defaultIfNotFound; |
|
| 17 | } |
||
| 18 | |||
| 19 | 31 | $rules = $this->getFeature($feature); |
|
| 20 | 31 | if (! is_array($rules)) { |
|
| 21 | 1 | return (bool) $rules; |
|
| 22 | } |
||
| 23 | |||
| 24 | 30 | $enabled = false; |
|
| 25 | 30 | foreach ($rules as $rule) { |
|
| 26 | 30 | if (true === self::isTrue($this->decideRules($rule, $user))) { |
|
| 27 | 14 | $enabled = true; |
|
| 28 | 14 | } |
|
| 29 | 30 | } |
|
| 30 | |||
| 31 | 30 | return $enabled; |
|
| 32 | } |
||
| 33 | |||
| 73 |