@@ -18,56 +18,56 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public static function evaluate($value, string $rule, array $args): bool |
| 20 | 20 | { |
| 21 | - switch($rule) { |
|
| 21 | + switch ($rule) { |
|
| 22 | 22 | case '=': |
| 23 | - if(strval($value) === strval($args[0])) { |
|
| 23 | + if (strval($value) === strval($args[0])) { |
|
| 24 | 24 | return true; |
| 25 | 25 | } |
| 26 | 26 | break; |
| 27 | 27 | case '!=': |
| 28 | - if(strval($value) !== strval($args[0])) { |
|
| 28 | + if (strval($value) !== strval($args[0])) { |
|
| 29 | 29 | return true; |
| 30 | 30 | } |
| 31 | 31 | break; |
| 32 | 32 | case '>': |
| 33 | - if($value > $args[0]) { |
|
| 33 | + if ($value > $args[0]) { |
|
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | break; |
| 37 | 37 | case '>=': |
| 38 | - if($value >= $args[0]) { |
|
| 38 | + if ($value >= $args[0]) { |
|
| 39 | 39 | return true; |
| 40 | 40 | } |
| 41 | 41 | break; |
| 42 | 42 | case '<': |
| 43 | - if($value < $args[0]) { |
|
| 43 | + if ($value < $args[0]) { |
|
| 44 | 44 | return true; |
| 45 | 45 | } |
| 46 | 46 | break; |
| 47 | 47 | case '<=': |
| 48 | - if($value <= $args[0]) { |
|
| 48 | + if ($value <= $args[0]) { |
|
| 49 | 49 | return true; |
| 50 | 50 | } |
| 51 | 51 | break; |
| 52 | 52 | case 'between': |
| 53 | - if($value >= $args[0] && $value <= $args[1]) { |
|
| 53 | + if ($value >= $args[0] && $value <= $args[1]) { |
|
| 54 | 54 | return true; |
| 55 | 55 | } |
| 56 | 56 | break; |
| 57 | 57 | case 'between strict': |
| 58 | - if($value > $args[0] && $value < $args[1]) { |
|
| 58 | + if ($value > $args[0] && $value < $args[1]) { |
|
| 59 | 59 | return true; |
| 60 | 60 | } |
| 61 | 61 | break; |
| 62 | 62 | case 'in': |
| 63 | 63 | /** @var array{array<mixed>} $args */ |
| 64 | - if(in_array($value, $args[0])) { |
|
| 64 | + if (in_array($value, $args[0])) { |
|
| 65 | 65 | return true; |
| 66 | 66 | } |
| 67 | 67 | break; |
| 68 | 68 | case 'not in': |
| 69 | 69 | /** @var array{array<mixed>} $args */ |
| 70 | - if(!in_array($value, $args[0])) { |
|
| 70 | + if (!in_array($value, $args[0])) { |
|
| 71 | 71 | return true; |
| 72 | 72 | } |
| 73 | 73 | break; |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | public static function flatten(array $input): array |
| 18 | 18 | { |
| 19 | 19 | $tmp = []; |
| 20 | - foreach($input as $val) { |
|
| 21 | - if(is_array($val)) { |
|
| 20 | + foreach ($input as $val) { |
|
| 21 | + if (is_array($val)) { |
|
| 22 | 22 | $tmp = array_merge($tmp, static::flatten($val)); |
| 23 | 23 | } else { |
| 24 | 24 | $tmp[] = $val; |