1 | <?php |
||
23 | abstract class BaseRange |
||
24 | { |
||
25 | public $start_limit; |
||
26 | public $end_limit; |
||
27 | public $start_incl; |
||
28 | public $end_incl; |
||
29 | |||
30 | protected $description; |
||
31 | |||
32 | /** |
||
33 | * getRegexp |
||
34 | * |
||
35 | * This function function must capture 4 elements of the description in |
||
36 | * this order: |
||
37 | * |
||
38 | * - left bracket style |
||
39 | * - left element |
||
40 | * - right element |
||
41 | * - right bracket style |
||
42 | * |
||
43 | * @access protected |
||
44 | * @return string |
||
45 | */ |
||
46 | abstract protected function getRegexp(); |
||
47 | |||
48 | /** |
||
49 | * getSubElement |
||
50 | * |
||
51 | * Return the representation for each element. |
||
52 | * |
||
53 | * @access protected |
||
54 | * @param string $element |
||
55 | * @return mixed |
||
56 | */ |
||
57 | abstract protected function getSubElement($element); |
||
58 | |||
59 | /** |
||
60 | * __construct |
||
61 | * |
||
62 | * Create an instance from a string definition. This string definition |
||
63 | * matches PostgreSQL range definition. |
||
64 | * |
||
65 | * @access public |
||
66 | * @param string $description |
||
67 | * @throws \InvalidArgumentException |
||
68 | */ |
||
69 | |||
70 | public function __construct($description) |
||
87 | |||
88 | /** |
||
89 | * __toString |
||
90 | * |
||
91 | * Text representation of a range. |
||
92 | * |
||
93 | * @access public |
||
94 | * @return string |
||
95 | */ |
||
96 | public function __toString() |
||
100 | } |
||
101 |