1 | <?php |
||
22 | abstract class GenericEquivalence implements Equivalence |
||
23 | { |
||
24 | /** |
||
25 | * Constant that represents the primitive type array . |
||
26 | */ |
||
27 | const TYPE_ARRAY = 'array'; |
||
28 | |||
29 | /** |
||
30 | * Constant that represents the primitive type boolean. |
||
31 | */ |
||
32 | const TYPE_BOOLEAN = 'boolean'; |
||
33 | |||
34 | /** |
||
35 | * Constant that represents the primitive type double. |
||
36 | */ |
||
37 | const TYPE_DOUBLE = 'double'; |
||
38 | |||
39 | /** |
||
40 | * Constant that represents the primitive type integer. |
||
41 | */ |
||
42 | const TYPE_INTEGER = 'integer'; |
||
43 | |||
44 | /** |
||
45 | * Constant that represents the primitive type NULL. |
||
46 | */ |
||
47 | const TYPE_NULL = 'NULL'; |
||
48 | |||
49 | /** |
||
50 | * Constant that represents the primitive type object. |
||
51 | */ |
||
52 | const TYPE_OBJECT = 'object'; |
||
53 | |||
54 | /** |
||
55 | * Constant that represents the primitive type resource. |
||
56 | */ |
||
57 | const TYPE_RESOURCE = 'resource'; |
||
58 | |||
59 | /** |
||
60 | * Constant that represents the primitive type string. |
||
61 | */ |
||
62 | const TYPE_STRING = 'string'; |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 360 | public function equivalent($left, $right) |
|
104 | |||
105 | /** |
||
106 | * Checks whether an array is equivalent to another value. |
||
107 | * |
||
108 | * @param array $left The array to compare. |
||
109 | * @param mixed $right The other value to compare. |
||
110 | * |
||
111 | * @return boolean Returns `true` if the given values are considered |
||
112 | * equivalent, `false` otherwise. |
||
113 | * |
||
114 | * @link http://php.net/manual/en/language.types.array.php PHP array |
||
115 | */ |
||
116 | abstract protected function equivalentArray(array $left, $right); |
||
117 | |||
118 | /** |
||
119 | * Checks whether a boolean value is equivalent to another value. |
||
120 | * |
||
121 | * @param boolean $left The boolean value to compare. |
||
122 | * @param mixed $right The other value to compare. |
||
123 | * |
||
124 | * @return boolean Returns `true` if the given values are considered |
||
125 | * equivalent, `false` otherwise. |
||
126 | * |
||
127 | * @link http://php.net/manual/en/language.types.boolean.php PHP boolean |
||
128 | */ |
||
129 | abstract protected function equivalentBoolean($left, $right); |
||
130 | |||
131 | /** |
||
132 | * Checks whether a floating-point number is equivalent to another value. |
||
133 | * |
||
134 | * @param float $left The floating-point number to compare. |
||
135 | * @param mixed $right The other value to compare. |
||
136 | * |
||
137 | * @return boolean Returns `true` if the given values are considered |
||
138 | * equivalent, `false` otherwise. |
||
139 | * |
||
140 | * @link http://php.net/manual/en/language.types.float.php PHP float |
||
141 | */ |
||
142 | abstract protected function equivalentFloat($left, $right); |
||
143 | |||
144 | /** |
||
145 | * Checks whether an integer number is equivalent to another value. |
||
146 | * |
||
147 | * @param integer $left The integer number to compare. |
||
148 | * @param mixed $right The other value to compare. |
||
149 | * |
||
150 | * @return boolean Returns `true` if the given values are considered |
||
151 | * equivalent, `false` otherwise. |
||
152 | * |
||
153 | * @link http://php.net/manual/en/language.types.integer.php PHP integer |
||
154 | */ |
||
155 | abstract protected function equivalentInteger($left, $right); |
||
156 | |||
157 | /** |
||
158 | * Checks whether value is equivalent to null. |
||
159 | * |
||
160 | * @param mixed $right The value to compare. |
||
161 | * |
||
162 | * @return boolean Returns `true` if the given value is considered |
||
163 | * equivalent to null, `false` otherwise. |
||
164 | * |
||
165 | * @link http://php.net/manual/en/language.types.null.php PHP NULL |
||
166 | */ |
||
167 | abstract protected function equivalentNull($right); |
||
168 | |||
169 | /** |
||
170 | * Checks whether an object is equivalent to another value. |
||
171 | * |
||
172 | * @param object $left The object to compare. |
||
173 | * @param mixed $right The other value to compare. |
||
174 | * |
||
175 | * @return boolean Returns `true` if the given values are considered |
||
176 | * equivalent, `false` otherwise. |
||
177 | * |
||
178 | * @link http://php.net/manual/en/language.types.object.php PHP object |
||
179 | */ |
||
180 | abstract protected function equivalentObject($left, $right); |
||
181 | |||
182 | /** |
||
183 | * Checks whether a resource is equivalent to another value. |
||
184 | * |
||
185 | * @param resource $left The resource to compare. |
||
186 | * @param mixed $right The other value to compare. |
||
187 | * |
||
188 | * @return boolean Returns `true` if the given values are considered |
||
189 | * equivalent, `false` otherwise. |
||
190 | * |
||
191 | * @link http://php.net/manual/en/language.types.resource.php PHP resource |
||
192 | */ |
||
193 | abstract protected function equivalentResource($left, $right); |
||
194 | |||
195 | /** |
||
196 | * Checks whether a string is equivalent to another value. |
||
197 | * |
||
198 | * @param string $left The string value to compare. |
||
199 | * @param mixed $right The other value to compare. |
||
200 | * |
||
201 | * @return boolean Returns `true` if the given values are considered |
||
202 | * equivalent, `false` otherwise. |
||
203 | * |
||
204 | * @link http://php.net/manual/en/language.types.string.php PHP string |
||
205 | */ |
||
206 | abstract protected function equivalentString($left, $right); |
||
207 | } |
||
208 |