| 1 | <?php |
||
| 5 | abstract class Comparer { |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Supported comparison signs |
||
| 9 | * |
||
| 10 | * @var array<string> |
||
| 11 | */ |
||
| 12 | protected $supported_comparison_operators = array(); |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Check if comparer supports the specified comparison sign |
||
| 16 | * |
||
| 17 | * @param string $comparison_operator |
||
| 18 | * @return bool |
||
| 19 | */ |
||
| 20 | public function supports_comparison_operator( $comparison_operator ) { |
||
| 21 | return in_array( $comparison_operator, $this->supported_comparison_operators ); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Check if comparison is true for $a and $b |
||
| 26 | * |
||
| 27 | * @param mixed $a |
||
| 28 | * @param string $comparison_operator |
||
| 29 | * @param mixed $b |
||
| 30 | * @return bool |
||
| 31 | */ |
||
| 32 | abstract public function is_correct( $a, $comparison_operator, $b ); |
||
| 33 | } |