@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param mixed $key The node key |
74 | 74 | * @param mixed $value The node value |
75 | 75 | * |
76 | - * @return A new node |
|
76 | + * @return TreeNode new node |
|
77 | 77 | * |
78 | 78 | * @since 1.0.0 |
79 | 79 | */ |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * Get the first node |
144 | 144 | * |
145 | - * @return the first node |
|
145 | + * @return TreeNode first node |
|
146 | 146 | * |
147 | 147 | * @since 1.0.0 |
148 | 148 | */ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | /** |
162 | 162 | * Get the last node |
163 | 163 | * |
164 | - * @return the last node |
|
164 | + * @return TreeNode last node |
|
165 | 165 | * |
166 | 166 | * @since 1.0.0 |
167 | 167 | */ |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * Get the predecessor |
182 | 182 | * |
183 | - * @return the predecessor node |
|
183 | + * @return TreeNode predecessor node |
|
184 | 184 | * |
185 | 185 | * @since 1.0.0 |
186 | 186 | */ |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Get the successor |
208 | 208 | * |
209 | - * @return the successor node |
|
209 | + * @return TreeNode successor node |
|
210 | 210 | * |
211 | 211 | * @since 1.0.0 |
212 | 212 | */ |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * +1 for the lowest key greater than or equal to the given key |
266 | 266 | * +2 for the lowest key greater than the given key |
267 | 267 | * |
268 | - * @return mixed The node or null if not found |
|
268 | + * @return TreeNode|null The node or null if not found |
|
269 | 269 | * |
270 | 270 | * @since 1.0.0 |
271 | 271 | */ |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | else |
496 | 496 | { |
497 | 497 | $this->left = new static($key, $value, $this->left, $this); |
498 | - $this->information|= 2; |
|
498 | + $this->information |= 2; |
|
499 | 499 | $node = $this->_decBalance(); |
500 | 500 | } |
501 | 501 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | else |
515 | 515 | { |
516 | 516 | $this->right = new static($key, $value, $this, $this->right); |
517 | - $this->information|= 1; |
|
517 | + $this->information |= 1; |
|
518 | 518 | $node = $this->_incBalance(); |
519 | 519 | } |
520 | 520 | } |
@@ -196,8 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | return $node; |
199 | - } |
|
200 | - else |
|
199 | + } else |
|
201 | 200 | { |
202 | 201 | return $this->left; |
203 | 202 | } |
@@ -222,8 +221,7 @@ discard block |
||
222 | 221 | } |
223 | 222 | |
224 | 223 | return $node; |
225 | - } |
|
226 | - else |
|
224 | + } else |
|
227 | 225 | { |
228 | 226 | return $this->right; |
229 | 227 | } |
@@ -280,12 +278,10 @@ discard block |
||
280 | 278 | if ($cmp < 0 && $node->information & 2) |
281 | 279 | { |
282 | 280 | $node = $node->left; |
283 | - } |
|
284 | - elseif ($cmp > 0 && $node->information & 1) |
|
281 | + } elseif ($cmp > 0 && $node->information & 1) |
|
285 | 282 | { |
286 | 283 | $node = $node->right; |
287 | - } |
|
288 | - else |
|
284 | + } else |
|
289 | 285 | { |
290 | 286 | break; |
291 | 287 | } |
@@ -296,42 +292,34 @@ discard block |
||
296 | 292 | if ($type < 0) |
297 | 293 | { |
298 | 294 | return $node->left; |
299 | - } |
|
300 | - elseif ($type > 0) |
|
295 | + } elseif ($type > 0) |
|
301 | 296 | { |
302 | 297 | return $node; |
303 | - } |
|
304 | - else |
|
298 | + } else |
|
305 | 299 | { |
306 | 300 | return null; |
307 | 301 | } |
308 | - } |
|
309 | - elseif ($cmp > 0) |
|
302 | + } elseif ($cmp > 0) |
|
310 | 303 | { |
311 | 304 | if ($type < 0) |
312 | 305 | { |
313 | 306 | return $node; |
314 | - } |
|
315 | - elseif ($type > 0) |
|
307 | + } elseif ($type > 0) |
|
316 | 308 | { |
317 | 309 | return $node->right; |
318 | - } |
|
319 | - else |
|
310 | + } else |
|
320 | 311 | { |
321 | 312 | return null; |
322 | 313 | } |
323 | - } |
|
324 | - else |
|
314 | + } else |
|
325 | 315 | { |
326 | 316 | if ($type < -1) |
327 | 317 | { |
328 | 318 | return $node->predecessor; |
329 | - } |
|
330 | - elseif ($type > 1) |
|
319 | + } elseif ($type > 1) |
|
331 | 320 | { |
332 | 321 | return $node->successor; |
333 | - } |
|
334 | - else |
|
322 | + } else |
|
335 | 323 | { |
336 | 324 | return $node; |
337 | 325 | } |
@@ -353,8 +341,7 @@ discard block |
||
353 | 341 | { |
354 | 342 | $this->right = $right->left; |
355 | 343 | $right->left = $this; |
356 | - } |
|
357 | - else |
|
344 | + } else |
|
358 | 345 | { |
359 | 346 | $right->information |= 2; |
360 | 347 | $this->information &= ~ 1; |
@@ -392,8 +379,7 @@ discard block |
||
392 | 379 | { |
393 | 380 | $this->left = $left->right; |
394 | 381 | $left->right = $this; |
395 | - } |
|
396 | - else |
|
382 | + } else |
|
397 | 383 | { |
398 | 384 | $this->information &= ~ 2; |
399 | 385 | $left->information |= 1; |
@@ -491,15 +477,13 @@ discard block |
||
491 | 477 | { |
492 | 478 | $node = $this->_decBalance(); |
493 | 479 | } |
494 | - } |
|
495 | - else |
|
480 | + } else |
|
496 | 481 | { |
497 | 482 | $this->left = new static($key, $value, $this->left, $this); |
498 | 483 | $this->information|= 2; |
499 | 484 | $node = $this->_decBalance(); |
500 | 485 | } |
501 | - } |
|
502 | - elseif ($cmp > 0) |
|
486 | + } elseif ($cmp > 0) |
|
503 | 487 | { |
504 | 488 | if ($this->information & 1) |
505 | 489 | { |
@@ -510,15 +494,13 @@ discard block |
||
510 | 494 | { |
511 | 495 | $node = $this->_incBalance(); |
512 | 496 | } |
513 | - } |
|
514 | - else |
|
497 | + } else |
|
515 | 498 | { |
516 | 499 | $this->right = new static($key, $value, $this, $this->right); |
517 | 500 | $this->information|= 1; |
518 | 501 | $node = $this->_incBalance(); |
519 | 502 | } |
520 | - } |
|
521 | - else |
|
503 | + } else |
|
522 | 504 | { |
523 | 505 | $this->value = $value; |
524 | 506 | } |
@@ -543,13 +525,11 @@ discard block |
||
543 | 525 | if (!($this->information & 2) || $leftBalance != 0 && ($this->left->information & ~3) == 0) |
544 | 526 | { |
545 | 527 | return $this->_incBalance(); |
546 | - } |
|
547 | - else |
|
528 | + } else |
|
548 | 529 | { |
549 | 530 | return $this; |
550 | 531 | } |
551 | - } |
|
552 | - else |
|
532 | + } else |
|
553 | 533 | { |
554 | 534 | $this->left->key = $this->key; |
555 | 535 | $this->left->value = $this->value; |
@@ -559,16 +539,14 @@ discard block |
||
559 | 539 | $this->right->left = $this->left; |
560 | 540 | |
561 | 541 | return $this->right; |
562 | - } |
|
563 | - else |
|
542 | + } else |
|
564 | 543 | { |
565 | 544 | if ($this->left->right == $this) |
566 | 545 | { |
567 | 546 | $this->left->information &= ~ 1; |
568 | 547 | |
569 | 548 | return $this->right; |
570 | - } |
|
571 | - else |
|
549 | + } else |
|
572 | 550 | { |
573 | 551 | $this->right->information &= ~ 2; |
574 | 552 | |
@@ -604,8 +582,7 @@ discard block |
||
604 | 582 | return $this->_incBalance(); |
605 | 583 | } |
606 | 584 | } |
607 | - } |
|
608 | - elseif ($cmp > 0) |
|
585 | + } elseif ($cmp > 0) |
|
609 | 586 | { |
610 | 587 | if ($this->information & 1) |
611 | 588 | { |
@@ -617,8 +594,7 @@ discard block |
||
617 | 594 | return $this->_decBalance(); |
618 | 595 | } |
619 | 596 | } |
620 | - } |
|
621 | - else |
|
597 | + } else |
|
622 | 598 | { |
623 | 599 | if ($this->information & 1) |
624 | 600 | { |
@@ -629,8 +605,7 @@ discard block |
||
629 | 605 | { |
630 | 606 | return $this->_decBalance(); |
631 | 607 | } |
632 | - } |
|
633 | - else |
|
608 | + } else |
|
634 | 609 | { |
635 | 610 | $left = $this->left; |
636 | 611 | $right = $this->right; |
@@ -640,22 +615,19 @@ discard block |
||
640 | 615 | $left->right = $right; |
641 | 616 | |
642 | 617 | return $left; |
643 | - } |
|
644 | - else |
|
618 | + } else |
|
645 | 619 | { |
646 | 620 | if ($left && $left->right == $this) |
647 | 621 | { |
648 | 622 | $left->information &= ~ 1; |
649 | 623 | |
650 | 624 | return $right; |
651 | - } |
|
652 | - elseif ($right && $right->left == $this) |
|
625 | + } elseif ($right && $right->left == $this) |
|
653 | 626 | { |
654 | 627 | $right->information &= ~ 2; |
655 | 628 | |
656 | 629 | return $left; |
657 | - } |
|
658 | - else |
|
630 | + } else |
|
659 | 631 | { |
660 | 632 | return null; |
661 | 633 | } |
@@ -115,20 +115,20 @@ |
||
115 | 115 | { |
116 | 116 | switch ($property) |
117 | 117 | { |
118 | - case 'first': |
|
119 | - return $this->first(); |
|
120 | - case 'last': |
|
121 | - return $this->last(); |
|
122 | - case 'predecessor': |
|
123 | - return $this->predecessor(); |
|
124 | - case 'successor': |
|
125 | - return $this->successor(); |
|
126 | - case 'key': |
|
127 | - return $this->key; |
|
128 | - case 'count': |
|
129 | - return $this->count(); |
|
130 | - default: |
|
131 | - throw new \RuntimeException('Undefined property'); |
|
118 | + case 'first': |
|
119 | + return $this->first(); |
|
120 | + case 'last': |
|
121 | + return $this->last(); |
|
122 | + case 'predecessor': |
|
123 | + return $this->predecessor(); |
|
124 | + case 'successor': |
|
125 | + return $this->successor(); |
|
126 | + case 'key': |
|
127 | + return $this->key; |
|
128 | + case 'count': |
|
129 | + return $this->count(); |
|
130 | + default: |
|
131 | + throw new \RuntimeException('Undefined property'); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 |
@@ -274,8 +274,7 @@ |
||
274 | 274 | try |
275 | 275 | { |
276 | 276 | return (bool) $this->map->find($element); |
277 | - } |
|
278 | - catch (\OutOfBoundsException $e) |
|
277 | + } catch (\OutOfBoundsException $e) |
|
279 | 278 | { |
280 | 279 | return false; |
281 | 280 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | if ($comparator == null) |
69 | 69 | { |
70 | - $this->comparator = function ($key1, $key2) |
|
70 | + $this->comparator = function($key1, $key2) |
|
71 | 71 | { |
72 | 72 | return $key1 - $key2; |
73 | 73 | }; |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | return $key1 - $key2; |
73 | 73 | }; |
74 | - } |
|
75 | - else |
|
74 | + } else |
|
76 | 75 | { |
77 | 76 | $this->comparator = $comparator; |
78 | 77 | } |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | if ($this->root) |
119 | 118 | { |
120 | 119 | return $this->root->first; |
121 | - } |
|
122 | - else |
|
120 | + } else |
|
123 | 121 | { |
124 | 122 | throw new \OutOfBoundsException('First element unexisting'); |
125 | 123 | } |
@@ -139,8 +137,7 @@ discard block |
||
139 | 137 | if ($this->root) |
140 | 138 | { |
141 | 139 | return $this->root->last; |
142 | - } |
|
143 | - else |
|
140 | + } else |
|
144 | 141 | { |
145 | 142 | throw new \OutOfBoundsException('Last element unexisting'); |
146 | 143 | } |
@@ -164,8 +161,7 @@ discard block |
||
164 | 161 | if ($predecessor) |
165 | 162 | { |
166 | 163 | return $predecessor; |
167 | - } |
|
168 | - else |
|
164 | + } else |
|
169 | 165 | { |
170 | 166 | throw new \OutOfBoundsException('Predecessor element unexisting'); |
171 | 167 | } |
@@ -189,8 +185,7 @@ discard block |
||
189 | 185 | if ($successor) |
190 | 186 | { |
191 | 187 | return $successor; |
192 | - } |
|
193 | - else |
|
188 | + } else |
|
194 | 189 | { |
195 | 190 | throw new \OutOfBoundsException('Successor element unexisting'); |
196 | 191 | } |
@@ -212,8 +207,7 @@ discard block |
||
212 | 207 | if ($this->root) |
213 | 208 | { |
214 | 209 | $lower = $this->root->find($key, $this->comparator, -2); |
215 | - } |
|
216 | - else |
|
210 | + } else |
|
217 | 211 | { |
218 | 212 | $lower = null; |
219 | 213 | } |
@@ -221,8 +215,7 @@ discard block |
||
221 | 215 | if ($lower) |
222 | 216 | { |
223 | 217 | return $lower; |
224 | - } |
|
225 | - else |
|
218 | + } else |
|
226 | 219 | { |
227 | 220 | throw new \OutOfBoundsException('Lower element unexisting'); |
228 | 221 | } |
@@ -244,8 +237,7 @@ discard block |
||
244 | 237 | if ($this->root) |
245 | 238 | { |
246 | 239 | $floor = $this->root->find($key, $this->comparator, -1); |
247 | - } |
|
248 | - else |
|
240 | + } else |
|
249 | 241 | { |
250 | 242 | $floor = null; |
251 | 243 | } |
@@ -253,8 +245,7 @@ discard block |
||
253 | 245 | if ($floor) |
254 | 246 | { |
255 | 247 | return $floor; |
256 | - } |
|
257 | - else |
|
248 | + } else |
|
258 | 249 | { |
259 | 250 | throw new \OutOfBoundsException('Floor element unexisting'); |
260 | 251 | } |
@@ -276,8 +267,7 @@ discard block |
||
276 | 267 | if ($this->root) |
277 | 268 | { |
278 | 269 | $find = $this->root->find($key, $this->comparator, 0); |
279 | - } |
|
280 | - else |
|
270 | + } else |
|
281 | 271 | { |
282 | 272 | $find = null; |
283 | 273 | } |
@@ -285,8 +275,7 @@ discard block |
||
285 | 275 | if ($find) |
286 | 276 | { |
287 | 277 | return $find; |
288 | - } |
|
289 | - else |
|
278 | + } else |
|
290 | 279 | { |
291 | 280 | throw new \OutOfBoundsException('Element unexisting'); |
292 | 281 | } |
@@ -308,8 +297,7 @@ discard block |
||
308 | 297 | if ($this->root) |
309 | 298 | { |
310 | 299 | $ceiling = $this->root->find($key, $this->comparator, 1); |
311 | - } |
|
312 | - else |
|
300 | + } else |
|
313 | 301 | { |
314 | 302 | $ceiling = null; |
315 | 303 | } |
@@ -317,8 +305,7 @@ discard block |
||
317 | 305 | if ($ceiling) |
318 | 306 | { |
319 | 307 | return $ceiling; |
320 | - } |
|
321 | - else |
|
308 | + } else |
|
322 | 309 | { |
323 | 310 | throw new \OutOfBoundsException('Ceiling element unexisting'); |
324 | 311 | } |
@@ -340,8 +327,7 @@ discard block |
||
340 | 327 | if ($this->root) |
341 | 328 | { |
342 | 329 | $higher = $this->root->find($key, $this->comparator, 2); |
343 | - } |
|
344 | - else |
|
330 | + } else |
|
345 | 331 | { |
346 | 332 | $higher = null; |
347 | 333 | } |
@@ -349,8 +335,7 @@ discard block |
||
349 | 335 | if ($higher) |
350 | 336 | { |
351 | 337 | return $higher; |
352 | - } |
|
353 | - else |
|
338 | + } else |
|
354 | 339 | { |
355 | 340 | throw new \OutOfBoundsException('Higher element unexisting'); |
356 | 341 | } |
@@ -460,8 +445,7 @@ discard block |
||
460 | 445 | if ($this->root) |
461 | 446 | { |
462 | 447 | $this->root = $this->root->insert($key, $value, $this->comparator); |
463 | - } |
|
464 | - else |
|
448 | + } else |
|
465 | 449 | { |
466 | 450 | $this->root = TreeNode::create($key, $value); |
467 | 451 | } |
@@ -496,8 +480,7 @@ discard block |
||
496 | 480 | if ($this->root) |
497 | 481 | { |
498 | 482 | return count($this->root); |
499 | - } |
|
500 | - else |
|
483 | + } else |
|
501 | 484 | { |
502 | 485 | return 0; |
503 | 486 | } |
@@ -131,8 +131,7 @@ |
||
131 | 131 | if ($value) |
132 | 132 | { |
133 | 133 | $map[$element] = true; |
134 | - } |
|
135 | - else |
|
134 | + } else |
|
136 | 135 | { |
137 | 136 | unset($map[$element]); |
138 | 137 | } |
@@ -385,8 +385,7 @@ discard block |
||
385 | 385 | try |
386 | 386 | { |
387 | 387 | return $this->find($key)->value; |
388 | - } |
|
389 | - catch (\OutOfBoundsException $e) |
|
388 | + } catch (\OutOfBoundsException $e) |
|
390 | 389 | { |
391 | 390 | throw new \OutOfRangeException('Undefined offset'); |
392 | 391 | } |
@@ -406,8 +405,7 @@ discard block |
||
406 | 405 | try |
407 | 406 | { |
408 | 407 | return (bool) $this->find($key); |
409 | - } |
|
410 | - catch (\OutOfBoundsException $e) |
|
408 | + } catch (\OutOfBoundsException $e) |
|
411 | 409 | { |
412 | 410 | return false; |
413 | 411 | } |
@@ -143,8 +143,7 @@ discard block |
||
143 | 143 | try |
144 | 144 | { |
145 | 145 | $this->current = $this->map->first(); |
146 | - } |
|
147 | - catch (\OutOfBoundsException $e) |
|
146 | + } catch (\OutOfBoundsException $e) |
|
148 | 147 | { |
149 | 148 | $this->current = null; |
150 | 149 | } |
@@ -162,8 +161,7 @@ discard block |
||
162 | 161 | if ($this->type == self::PAIRS) |
163 | 162 | { |
164 | 163 | return $this->current->key; |
165 | - } |
|
166 | - else |
|
164 | + } else |
|
167 | 165 | { |
168 | 166 | return $this->index; |
169 | 167 | } |
@@ -181,8 +179,7 @@ discard block |
||
181 | 179 | if ($this->type == self::KEYS) |
182 | 180 | { |
183 | 181 | return $this->current->key; |
184 | - } |
|
185 | - else |
|
182 | + } else |
|
186 | 183 | { |
187 | 184 | return $this->current->value; |
188 | 185 | } |
@@ -200,8 +197,7 @@ discard block |
||
200 | 197 | try |
201 | 198 | { |
202 | 199 | $this->current = $this->map->successor($this->current); |
203 | - } |
|
204 | - catch (\OutOfBoundsException $e) |
|
200 | + } catch (\OutOfBoundsException $e) |
|
205 | 201 | { |
206 | 202 | $this->current = null; |
207 | 203 | } |
@@ -212,17 +212,14 @@ discard block |
||
212 | 212 | if ($toOption == self::UNUSED) |
213 | 213 | { |
214 | 214 | $this->setMap(SubMap::view($set->getMap())); |
215 | - } |
|
216 | - else |
|
215 | + } else |
|
217 | 216 | { |
218 | 217 | $this->setMap(SubMap::head($set->getMap(), $to, $toOption == self::INCLUSIVE)); |
219 | 218 | } |
220 | - } |
|
221 | - elseif ($toOption == self::UNUSED) |
|
219 | + } elseif ($toOption == self::UNUSED) |
|
222 | 220 | { |
223 | 221 | $this->setMap(SubMap::tail($set->getMap(), $from, $fromOption == self::INCLUSIVE)); |
224 | - } |
|
225 | - else |
|
222 | + } else |
|
226 | 223 | { |
227 | 224 | $this->setMap(SubMap::create($set->getMap(), $from, $to, $fromOption == self::INCLUSIVE, $toOption == self::INCLUSIVE)); |
228 | 225 | } |
@@ -316,8 +313,7 @@ discard block |
||
316 | 313 | 'toInclusive' => $this->toInclusive, |
317 | 314 | ] |
318 | 315 | ]; |
319 | - } |
|
320 | - else |
|
316 | + } else |
|
321 | 317 | { |
322 | 318 | return [ |
323 | 319 | 'TailSet' => [ |
@@ -327,8 +323,7 @@ discard block |
||
327 | 323 | ] |
328 | 324 | ]; |
329 | 325 | } |
330 | - } |
|
331 | - else |
|
326 | + } else |
|
332 | 327 | { |
333 | 328 | if (isset($this->to)) |
334 | 329 | { |
@@ -339,8 +334,7 @@ discard block |
||
339 | 334 | 'toInclusive' => $this->toInclusive, |
340 | 335 | ] |
341 | 336 | ]; |
342 | - } |
|
343 | - else |
|
337 | + } else |
|
344 | 338 | { |
345 | 339 | return [ |
346 | 340 | 'ViewSet' => [ |
@@ -160,7 +160,7 @@ |
||
160 | 160 | * |
161 | 161 | * @param string $property The property |
162 | 162 | * |
163 | - * @return void |
|
163 | + * @return boolean |
|
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | 166 | */ |
@@ -67,9 +67,9 @@ |
||
67 | 67 | protected function __construct(SortedMap $map) |
68 | 68 | { |
69 | 69 | $this->map = $map; |
70 | - $this->comparator = function ($key1, $key2) |
|
70 | + $this->comparator = function($key1, $key2) |
|
71 | 71 | { |
72 | - return - call_user_func($this->map->comparator, $key1, $key2); |
|
72 | + return -call_user_func($this->map->comparator, $key1, $key2); |
|
73 | 73 | }; |
74 | 74 | } |
75 | 75 |
@@ -122,8 +122,7 @@ discard block |
||
122 | 122 | if ($this->fromOption == self::UNUSED) |
123 | 123 | { |
124 | 124 | throw new \RuntimeException('Undefined property'); |
125 | - } |
|
126 | - else |
|
125 | + } else |
|
127 | 126 | { |
128 | 127 | return $this->fromKey; |
129 | 128 | } |
@@ -132,8 +131,7 @@ discard block |
||
132 | 131 | if ($this->toOption == self::UNUSED) |
133 | 132 | { |
134 | 133 | throw new \RuntimeException('Undefined property'); |
135 | - } |
|
136 | - else |
|
134 | + } else |
|
137 | 135 | { |
138 | 136 | return $this->toKey; |
139 | 137 | } |
@@ -142,8 +140,7 @@ discard block |
||
142 | 140 | if ($this->fromOption == self::UNUSED) |
143 | 141 | { |
144 | 142 | throw new \RuntimeException('Undefined property'); |
145 | - } |
|
146 | - else |
|
143 | + } else |
|
147 | 144 | { |
148 | 145 | return $this->fromOption == self::INCLUSIVE; |
149 | 146 | } |
@@ -152,8 +149,7 @@ discard block |
||
152 | 149 | if ($this->toOption == self::UNUSED) |
153 | 150 | { |
154 | 151 | throw new \RuntimeException('Undefined property'); |
155 | - } |
|
156 | - else |
|
152 | + } else |
|
157 | 153 | { |
158 | 154 | return $this->toOption == self::INCLUSIVE; |
159 | 155 | } |
@@ -203,8 +199,7 @@ discard block |
||
203 | 199 | if ($this->fromOption == self::UNUSED) |
204 | 200 | { |
205 | 201 | throw new \RuntimeException('Undefined property'); |
206 | - } |
|
207 | - else |
|
202 | + } else |
|
208 | 203 | { |
209 | 204 | $this->fromOption = $value ? self::INCLUSIVE : self::EXCLUSIVE; |
210 | 205 | } |
@@ -213,8 +208,7 @@ discard block |
||
213 | 208 | if ($this->toOption == self::UNUSED) |
214 | 209 | { |
215 | 210 | throw new \RuntimeException('Undefined property'); |
216 | - } |
|
217 | - else |
|
211 | + } else |
|
218 | 212 | { |
219 | 213 | $this->toOption = $value ? self::INCLUSIVE : self::EXCLUSIVE; |
220 | 214 | } |
@@ -318,8 +312,7 @@ discard block |
||
318 | 312 | $cmp = call_user_func($this->map->comparator(), $this->fromKey, $this->toKey); |
319 | 313 | |
320 | 314 | $this->empty = $cmp > 0 || $cmp == 0 && ($this->fromOption == self::EXCLUSIVE || $this->toOption == self::EXCLUSIVE); |
321 | - } |
|
322 | - else |
|
315 | + } else |
|
323 | 316 | { |
324 | 317 | $this->empty = false; |
325 | 318 | } |
@@ -566,8 +559,7 @@ discard block |
||
566 | 559 | if (call_user_func($this->map->comparator(), $key, $this->fromKey) <= 0) |
567 | 560 | { |
568 | 561 | throw new \OutOfBoundsException('Lower element unexisting'); |
569 | - } |
|
570 | - else |
|
562 | + } else |
|
571 | 563 | { |
572 | 564 | $lower = $this->map->lower($key); |
573 | 565 | |
@@ -625,8 +617,7 @@ discard block |
||
625 | 617 | if (call_user_func($this->map->comparator(), $key, $this->fromKey) < 0) |
626 | 618 | { |
627 | 619 | throw new \OutOfBoundsException('Floor element unexisting'); |
628 | - } |
|
629 | - else |
|
620 | + } else |
|
630 | 621 | { |
631 | 622 | $floor = $this->map->floor($key); |
632 | 623 | } |
@@ -635,8 +626,7 @@ discard block |
||
635 | 626 | if (call_user_func($this->map->comparator(), $key, $this->fromKey) <= 0) |
636 | 627 | { |
637 | 628 | throw new \OutOfBoundsException('Floor element unexisting'); |
638 | - } |
|
639 | - else |
|
629 | + } else |
|
640 | 630 | { |
641 | 631 | $floor = $this->map->floor($key); |
642 | 632 | } |
@@ -740,8 +730,7 @@ discard block |
||
740 | 730 | if (call_user_func($this->map->comparator(), $key, $this->toKey) > 0) |
741 | 731 | { |
742 | 732 | throw new \OutOfBoundsException('Ceiling element unexisting'); |
743 | - } |
|
744 | - else |
|
733 | + } else |
|
745 | 734 | { |
746 | 735 | $ceiling = $this->map->ceiling($key); |
747 | 736 | } |
@@ -750,8 +739,7 @@ discard block |
||
750 | 739 | if (call_user_func($this->map->comparator(), $key, $this->toKey) >= 0) |
751 | 740 | { |
752 | 741 | throw new \OutOfBoundsException('Ceiling element unexisting'); |
753 | - } |
|
754 | - else |
|
742 | + } else |
|
755 | 743 | { |
756 | 744 | $ceiling = $this->map->ceiling($key); |
757 | 745 | } |
@@ -810,8 +798,7 @@ discard block |
||
810 | 798 | if (call_user_func($this->map->comparator(), $key, $this->toKey) >= 0) |
811 | 799 | { |
812 | 800 | throw new \OutOfBoundsException('Higher element unexisting'); |
813 | - } |
|
814 | - else |
|
801 | + } else |
|
815 | 802 | { |
816 | 803 | $higher = $this->map->higher($key); |
817 | 804 | |
@@ -863,8 +850,7 @@ discard block |
||
863 | 850 | 'map' => $this->map->jsonSerialize(), |
864 | 851 | ] |
865 | 852 | ]; |
866 | - } |
|
867 | - else |
|
853 | + } else |
|
868 | 854 | { |
869 | 855 | return [ |
870 | 856 | 'HeadMap' => [ |
@@ -874,8 +860,7 @@ discard block |
||
874 | 860 | ] |
875 | 861 | ]; |
876 | 862 | } |
877 | - } |
|
878 | - else |
|
863 | + } else |
|
879 | 864 | { |
880 | 865 | if ($this->toOption == self::UNUSED) |
881 | 866 | { |
@@ -886,8 +871,7 @@ discard block |
||
886 | 871 | 'fromInclusive' => $this->fromOption == self::INCLUSIVE, |
887 | 872 | ] |
888 | 873 | ]; |
889 | - } |
|
890 | - else |
|
874 | + } else |
|
891 | 875 | { |
892 | 876 | return [ |
893 | 877 | 'SubMap' => [ |
@@ -168,7 +168,7 @@ |
||
168 | 168 | * |
169 | 169 | * @param string $property The property |
170 | 170 | * |
171 | - * @return void |
|
171 | + * @return boolean|null |
|
172 | 172 | * |
173 | 173 | * @since 1.0.0 |
174 | 174 | */ |