1 | <?php |
||
11 | abstract class Condition implements Fulfillable { |
||
12 | |||
13 | /** |
||
14 | * Condition value to check |
||
15 | * |
||
16 | * @var mixed |
||
17 | */ |
||
18 | protected $value; |
||
19 | |||
20 | /** |
||
21 | * Comparers to use for condition checking |
||
22 | * |
||
23 | * @var array<Comparer> |
||
24 | */ |
||
25 | protected $comparers = array(); |
||
26 | |||
27 | /** |
||
28 | * Comparison string to use |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $comparison_operator = ''; |
||
33 | |||
34 | /** |
||
35 | * Get the condition value |
||
36 | * |
||
37 | * @return mixed |
||
38 | */ |
||
39 | public function get_value() { |
||
45 | |||
46 | /** |
||
47 | * Set the condition value |
||
48 | * |
||
49 | * @param mixed $value |
||
50 | * @return Condition $this |
||
51 | */ |
||
52 | public function set_value( $value ) { |
||
56 | |||
57 | /** |
||
58 | * Get the condition comparers |
||
59 | * |
||
60 | * @return array<Comparer> |
||
61 | */ |
||
62 | protected function get_comparers() { |
||
65 | |||
66 | /** |
||
67 | * Set the condition comparers |
||
68 | * |
||
69 | * @param array<Comparer> $comparers |
||
70 | * @return Condition $this |
||
71 | */ |
||
72 | public function set_comparers( $comparers ) { |
||
76 | |||
77 | /** |
||
78 | * Find the first operator which supports $comparison_operator and check if it is correct for $a and $b |
||
79 | * |
||
80 | * @param mixed $a |
||
81 | * @param string $comparison_operator |
||
82 | * @param mixed $b |
||
83 | * @return bool |
||
84 | */ |
||
85 | protected function compare( $a, $comparison_operator, $b ) { |
||
97 | |||
98 | /** |
||
99 | * Get comparison sign used |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | public function get_comparison_operator() { |
||
106 | |||
107 | /** |
||
108 | * Set comparison sign |
||
109 | * |
||
110 | * @param string $comparison_operator |
||
111 | * @return Comparer $this |
||
112 | */ |
||
113 | public function set_comparison_operator( $comparison_operator ) { |
||
117 | } |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.