1 | <?php |
||
10 | abstract class Condition implements Fulfillable { |
||
11 | |||
12 | /** |
||
13 | * Condition value to check |
||
14 | * |
||
15 | * @var mixed |
||
16 | */ |
||
17 | protected $value; |
||
18 | |||
19 | /** |
||
20 | * Comparers to use for condition checking |
||
21 | * |
||
22 | * @var array<Comparer> |
||
23 | */ |
||
24 | protected $comparers = array(); |
||
25 | |||
26 | /** |
||
27 | * Comparison string to use |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $comparison_operator = ''; |
||
32 | |||
33 | /** |
||
34 | * Constructor |
||
35 | * |
||
36 | * @param array<Carbon_Fields\Container\Condition\Comparer\Comparer> $comparers |
||
37 | */ |
||
38 | public function __construct( $comparers ) { |
||
41 | |||
42 | /** |
||
43 | * Get the condition value |
||
44 | * |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function get_value() { |
||
50 | |||
51 | /** |
||
52 | * Set the condition value |
||
53 | * |
||
54 | * @param mixed $value |
||
55 | * @return Condition $this |
||
56 | */ |
||
57 | public function set_value( $value ) { |
||
61 | |||
62 | /** |
||
63 | * Get the condition comparers |
||
64 | * |
||
65 | * @return array<Comparer> |
||
66 | */ |
||
67 | protected function get_comparers() { |
||
70 | |||
71 | /** |
||
72 | * Set the condition comparers |
||
73 | * |
||
74 | * @param array<Comparer> $comparers |
||
75 | * @return Condition $this |
||
76 | */ |
||
77 | protected function set_comparers( $comparers ) { |
||
81 | |||
82 | /** |
||
83 | * Check if any comparer is correct for $a and $b |
||
84 | * |
||
85 | * @param mixed $a |
||
86 | * @param string $comparison_operator |
||
87 | * @param mixed $b |
||
88 | * @return bool |
||
89 | */ |
||
90 | protected function first_supported_comparer_is_correct( $a, $comparison_operator, $b ) { |
||
102 | |||
103 | /** |
||
104 | * Get comparison sign used |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function get_comparison_operator() { |
||
111 | |||
112 | /** |
||
113 | * Set comparison sign |
||
114 | * |
||
115 | * @param string $comparison_operator |
||
116 | * @return Comparer $this |
||
117 | */ |
||
118 | public function set_comparison_operator( $comparison_operator ) { |
||
122 | } |