| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 24 | public function decide($value, $user = null, $defaultValue = false) |
|
| 14 | { |
||
| 15 | 24 | if (! $this->valueExists($value)) { |
|
| 16 | 2 | return $defaultValue; |
|
| 17 | } |
||
| 18 | |||
| 19 | 22 | $rules = $this->getValueRules($value); |
|
| 20 | 22 | if (! is_array($rules)) { |
|
| 21 | 1 | return $rules; |
|
| 22 | } |
||
| 23 | |||
| 24 | 21 | foreach ($rules as $rule) { |
|
| 25 | 21 | if (false !== $value = $this->decideRules($rule, $user)) { |
|
| 26 | 14 | return $value; |
|
| 27 | } |
||
| 28 | 13 | } |
|
| 29 | |||
| 30 | 7 | return $defaultValue; |
|
| 31 | } |
||
| 32 | |||
| 59 |