Passed
Branch master (73cfe8)
by Ondřej
06:41
created
src/Ivory/Value/NetAddress.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     /**
117
-     * @return bool whether the PHP was built with IPv6 support enabled
117
+     * @return boolean|null whether the PHP was built with IPv6 support enabled
118 118
      */
119 119
     private static function ipv6Support()
120 120
     {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @param NetAddress|string $address a {@link NetAddress} or anything {@link NetAddress::fromString()} accepts as
350 350
      *                                     its first argument
351
-     * @return bool
351
+     * @return null|boolean
352 352
      */
353 353
     public function equals($address)
354 354
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@
 block discarded – undo
287 287
                 $i += $lzsLen - 1;
288 288
                 continue;
289 289
             }
290
-            $result .= (ltrim($fields[$i], '0') ? : '0');
290
+            $result .= (ltrim($fields[$i], '0') ?: '0');
291 291
         }
292 292
         if ($lzsStart + $lzsLen == 8) {
293 293
             $result .= ':';
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         if ($netmaskLengthOrNetmask === null) {
138 138
             $this->netmaskLength = ($this->ipVersion == 6 ? 128 : 32);
139
-        }
140
-        else {
139
+        } else {
141 140
             if (filter_var($netmaskLengthOrNetmask, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) {
142 141
                 if ($this->ipVersion == 4) {
143 142
                     // taken from http://php.net/manual/en/function.ip2long.php#94787
@@ -148,12 +147,10 @@  discard block
 block discarded – undo
148 147
                         throw new \InvalidArgumentException('Invalid netmask');
149 148
                     }
150 149
                     $this->netmaskLength = 32 - (int)$bits;
151
-                }
152
-                else {
150
+                } else {
153 151
                     throw new \InvalidArgumentException('Netmask may only be used for an IPv4 address.');
154 152
                 }
155
-            }
156
-            else {
153
+            } else {
157 154
                 $this->netmaskLength = filter_var($netmaskLengthOrNetmask, FILTER_VALIDATE_INT);
158 155
                 if ($this->netmaskLength === false) {
159 156
                     throw new \InvalidArgumentException('$netmaskLengthOrNetmask');
@@ -212,8 +209,7 @@  discard block
 block discarded – undo
212 209
     {
213 210
         if ($this->ipVersion == 4) {
214 211
             return $this->addrStr;
215
-        }
216
-        else {
212
+        } else {
217 213
             if (!self::ipv6Support()) {
218 214
                 throw new NotImplementedException('PHP must be compiled with IPv6 support');
219 215
             }
@@ -259,12 +255,10 @@  discard block
 block discarded – undo
259 255
                 if ($czsStart === null) {
260 256
                     $czsStart = $i;
261 257
                     $czsLen = 1;
262
-                }
263
-                else {
258
+                } else {
264 259
                     $czsLen++;
265 260
                 }
266
-            }
267
-            else {
261
+            } else {
268 262
                 if ($czsStart !== null) {
269 263
                     if ($czsLen > $lzsLen) {
270 264
                         $lzsStart = $czsStart;
@@ -302,8 +296,7 @@  discard block
 block discarded – undo
302 296
     {
303 297
         if ($this->ipVersion == 6) {
304 298
             return ($this->netmaskLength == 128);
305
-        }
306
-        else {
299
+        } else {
307 300
             return ($this->netmaskLength == 32);
308 301
         }
309 302
     }
@@ -318,8 +311,7 @@  discard block
 block discarded – undo
318 311
             $hostPartLen = 32 - $this->netmaskLength;
319 312
             $mask = (1 << $hostPartLen) - 1;
320 313
             return ((ip2long($this->addrStr) & $mask) == 0);
321
-        }
322
-        else {
314
+        } else {
323 315
             $hostPartLen = 128 - $this->netmaskLength;
324 316
             $hostPartOctets = (int)floor($hostPartLen / 8);
325 317
             $hostPartLeadBits = $hostPartLen % 8;
@@ -436,8 +428,7 @@  discard block
 block discarded – undo
436 428
     {
437 429
         if ($this->isSingleHost()) {
438 430
             return $this->addrStr;
439
-        }
440
-        else {
431
+        } else {
441 432
             return $this->toCidrString();
442 433
         }
443 434
     }
@@ -461,8 +452,7 @@  discard block
 block discarded – undo
461 452
     {
462 453
         if ($this->ipVersion == 4 || self::ipv6Support()) {
463 454
             return inet_pton($this->addrStr);
464
-        }
465
-        else {
455
+        } else {
466 456
             throw new NotImplementedException('PHP must be compiled with IPv6 support');
467 457
         }
468 458
     }
@@ -480,8 +470,7 @@  discard block
 block discarded – undo
480 470
     {
481 471
         if ($this->ipVersion == 4) {
482 472
             return ip2long($this->addrStr);
483
-        }
484
-        else {
473
+        } else {
485 474
             throw new \LogicException('IPv6 address cannot be converted to long');
486 475
         }
487 476
     }
Please login to merge, or discard this patch.
src/Ivory/Value/Range.php 2 patches
Doc Comments   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -166,6 +166,9 @@  discard block
 block discarded – undo
166 166
         return new Range($subtype, null, true, null, null, null, null);
167 167
     }
168 168
 
169
+    /**
170
+     * @param boolean $upperInc
171
+     */
169 172
     private static function processBoundSpec($boundsOrLowerInc = '[)', $upperInc = null)
170 173
     {
171 174
         if (is_string($boundsOrLowerInc)) {
@@ -193,6 +196,10 @@  discard block
 block discarded – undo
193 196
     }
194 197
 
195 198
 
199
+    /**
200
+     * @param IRangeCanonicalFunc|null $canonicalFunc
201
+     * @param boolean $empty
202
+     */
196 203
     private function __construct(ITotallyOrderedType $subtype, $canonicalFunc, $empty, $lower, $upper, $lowerInc, $upperInc)
197 204
     {
198 205
         $this->subtype = $subtype;
@@ -372,7 +379,7 @@  discard block
 block discarded – undo
372 379
 
373 380
     /**
374 381
      * @param mixed $element a value of the range subtype
375
-     * @return bool whether this range contains the given element;
382
+     * @return null|boolean whether this range contains the given element;
376 383
      *              <tt>null</tt> on <tt>null</tt> input
377 384
      */
378 385
     public function containsElement($element)
@@ -403,7 +410,7 @@  discard block
 block discarded – undo
403 410
 
404 411
     /**
405 412
      * @param mixed $element value of the range subtype
406
-     * @return bool <tt>true</tt> iff this range is left of the given element - value of the range subtype;
413
+     * @return null|boolean <tt>true</tt> iff this range is left of the given element - value of the range subtype;
407 414
      *              <tt>false</tt> otherwise, especially if this range is empty;
408 415
      *              <tt>null</tt> on <tt>null</tt> input
409 416
      */
@@ -425,7 +432,7 @@  discard block
 block discarded – undo
425 432
 
426 433
     /**
427 434
      * @param mixed $element value of the range subtype
428
-     * @return bool <tt>true</tt> iff this range is right of the given element - value of the range subtype;
435
+     * @return null|boolean <tt>true</tt> iff this range is right of the given element - value of the range subtype;
429 436
      *              <tt>false</tt> otherwise, especially if this range is empty;
430 437
      *              <tt>null</tt> on <tt>null</tt> input
431 438
      */
@@ -447,7 +454,7 @@  discard block
 block discarded – undo
447 454
 
448 455
     /**
449 456
      * @param Range $other a range of the same subtype as this range
450
-     * @return bool whether this range entirely contains the other range;
457
+     * @return null|boolean whether this range entirely contains the other range;
451 458
      *              an empty range is considered to be contained in any range, even an empty one;
452 459
      *              <tt>null</tt> on <tt>null</tt> input
453 460
      */
@@ -495,7 +502,7 @@  discard block
 block discarded – undo
495 502
 
496 503
     /**
497 504
      * @param Range $other a range of the same subtype as this range
498
-     * @return bool whether this range is entirely contained in the other range;
505
+     * @return null|boolean whether this range is entirely contained in the other range;
499 506
      *              an empty range is considered to be contained in any range, even an empty one;
500 507
      *              <tt>null</tt> on <tt>null</tt> input
501 508
      */
@@ -512,7 +519,7 @@  discard block
 block discarded – undo
512 519
 
513 520
     /**
514 521
      * @param Range $other a range of the same subtype as this range
515
-     * @return bool whether this and the other range overlap, i.e., have a non-empty intersection;
522
+     * @return null|boolean whether this and the other range overlap, i.e., have a non-empty intersection;
516 523
      *              <tt>null</tt> on <tt>null</tt> input
517 524
      */
518 525
     public function overlaps($other)
@@ -626,7 +633,7 @@  discard block
 block discarded – undo
626 633
 
627 634
     /**
628 635
      * @param Range|null $other a range of the same subtype as this range
629
-     * @return bool <tt>true</tt> iff this range is strictly left of the other range, i.e., it ends before the other
636
+     * @return null|boolean <tt>true</tt> iff this range is strictly left of the other range, i.e., it ends before the other
630 637
      *                starts;
631 638
      *              <tt>false</tt> otherwise, especially if either range is empty;
632 639
      *              <tt>null</tt> on <tt>null</tt> input
@@ -652,7 +659,7 @@  discard block
 block discarded – undo
652 659
 
653 660
     /**
654 661
      * @param Range|null $other a range of the same subtype as this range
655
-     * @return bool <tt>true</tt> iff this range is strictly left of the other range, i.e., it ends before the other
662
+     * @return null|boolean <tt>true</tt> iff this range is strictly left of the other range, i.e., it ends before the other
656 663
      *                starts;
657 664
      *              <tt>false</tt> otherwise, especially if either range is empty;;
658 665
      *              <tt>null</tt> on <tt>null</tt> input
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -108,14 +108,12 @@  discard block
 block discarded – undo
108 108
             $comp = $subtype->compareValues($lower, $upper);
109 109
             if ($comp > 0) {
110 110
                 return self::createEmpty($subtype);
111
-            }
112
-            elseif ($comp == 0) {
111
+            } elseif ($comp == 0) {
113 112
                 if (!$loInc || !$upInc) {
114 113
                     return self::createEmpty($subtype);
115 114
                 }
116 115
             }
117
-        }
118
-        else {
116
+        } else {
119 117
             if ($lower === null) {
120 118
                 $loInc = false;
121 119
             }
@@ -135,14 +133,12 @@  discard block
 block discarded – undo
135 133
                 $comp = $subtype->compareValues($lower, $upper);
136 134
                 if ($comp > 0) {
137 135
                     return self::createEmpty($subtype);
138
-                }
139
-                elseif ($comp == 0) {
136
+                } elseif ($comp == 0) {
140 137
                     if (!$loInc || !$upInc) {
141 138
                         return self::createEmpty($subtype);
142 139
                     }
143 140
                 }
144
-            }
145
-            else {
141
+            } else {
146 142
                 if ($lower === null) {
147 143
                     $loInc = false;
148 144
                 }
@@ -183,8 +179,7 @@  discard block
 block discarded – undo
183 179
 
184 180
             $loInc = ($boundsOrLowerInc[0] == '[');
185 181
             $upInc = ($boundsOrLowerInc[1] == ']');
186
-        }
187
-        else {
182
+        } else {
188 183
             $loInc = (bool)$boundsOrLowerInc;
189 184
             $upInc = (bool)$upperInc;
190 185
         }
@@ -263,8 +258,7 @@  discard block
 block discarded – undo
263 258
     {
264 259
         if ($this->empty) {
265 260
             return null;
266
-        }
267
-        else {
261
+        } else {
268 262
             return ($this->lowerInc ? '[' : '(') . ($this->upperInc ? ']' : ')');
269 263
         }
270 264
     }
@@ -289,8 +283,7 @@  discard block
 block discarded – undo
289 283
             $lo = ($this->lowerInc ? $this->lower : $this->subtype->step(1, $this->lower));
290 284
             $up = ($this->upperInc ? $this->upper : $this->subtype->step(-1, $this->upper));
291 285
             return ($this->subtype->compareValues($lo, $up) == 0);
292
-        }
293
-        else {
286
+        } else {
294 287
             return false;
295 288
         }
296 289
     }
@@ -328,8 +321,7 @@  discard block
 block discarded – undo
328 321
 
329 322
         if ($this->lower === null) {
330 323
             $lo = null;
331
-        }
332
-        else {
324
+        } else {
333 325
             $lo = $this->lower;
334 326
             $step = $loInc - $this->lowerInc;
335 327
             if ($step) {
@@ -339,8 +331,7 @@  discard block
 block discarded – undo
339 331
 
340 332
         if ($this->upper === null) {
341 333
             $up = null;
342
-        }
343
-        else {
334
+        } else {
344 335
             $up = $this->upper;
345 336
             $step = $this->upperInc - $upInc;
346 337
             if ($step) {
@@ -469,8 +460,7 @@  discard block
 block discarded – undo
469 460
         if ($this->lower !== null) {
470 461
             if ($other->lower === null) {
471 462
                 return false;
472
-            }
473
-            else {
463
+            } else {
474 464
                 $cmp = $this->subtype->compareValues($this->lower, $other->lower);
475 465
                 if ($cmp > 0 || ($cmp == 0 && !$this->lowerInc && $other->lowerInc)) {
476 466
                     return false;
@@ -481,8 +471,7 @@  discard block
 block discarded – undo
481 471
         if ($this->upper !== null) {
482 472
             if ($other->upper === null) {
483 473
                 return false;
484
-            }
485
-            else {
474
+            } else {
486 475
                 $cmp = $this->subtype->compareValues($this->upper, $other->upper);
487 476
                 if ($cmp < 0 || ($cmp == 0 && !$this->upperInc && $other->upperInc)) {
488 477
                     return false;
@@ -567,22 +556,18 @@  discard block
 block discarded – undo
567 556
         if ($this->lower === null) {
568 557
             $lo = $other->lower;
569 558
             $loInc = $other->lowerInc;
570
-        }
571
-        elseif ($other->lower === null) {
559
+        } elseif ($other->lower === null) {
572 560
             $lo = $this->lower;
573 561
             $loInc = $this->lowerInc;
574
-        }
575
-        else {
562
+        } else {
576 563
             $cmp = $this->subtype->compareValues($this->lower, $other->lower);
577 564
             if ($cmp < 0) {
578 565
                 $lo = $other->lower;
579 566
                 $loInc = $other->lowerInc;
580
-            }
581
-            elseif ($cmp > 0) {
567
+            } elseif ($cmp > 0) {
582 568
                 $lo = $this->lower;
583 569
                 $loInc = $this->lowerInc;
584
-            }
585
-            else {
570
+            } else {
586 571
                 $lo = $this->lower;
587 572
                 $loInc = ($this->lowerInc && $other->lowerInc);
588 573
             }
@@ -591,22 +576,18 @@  discard block
 block discarded – undo
591 576
         if ($this->upper === null) {
592 577
             $up = $other->upper;
593 578
             $upInc = $other->upperInc;
594
-        }
595
-        elseif ($other->upper === null) {
579
+        } elseif ($other->upper === null) {
596 580
             $up = $this->upper;
597 581
             $upInc = $this->upperInc;
598
-        }
599
-        else {
582
+        } else {
600 583
             $cmp = $this->subtype->compareValues($this->upper, $other->upper);
601 584
             if ($cmp < 0) {
602 585
                 $up = $this->upper;
603 586
                 $upInc = $this->upperInc;
604
-            }
605
-            elseif ($cmp > 0) {
587
+            } elseif ($cmp > 0) {
606 588
                 $up = $other->upper;
607 589
                 $upInc = $other->upperInc;
608
-            }
609
-            else {
590
+            } else {
610 591
                 $up = $this->upper;
611 592
                 $upInc = ($this->upperInc && $other->upperInc);
612 593
             }
@@ -710,13 +691,11 @@  discard block
 block discarded – undo
710 691
             if ($object->lower !== null) {
711 692
                 return false;
712 693
             }
713
-        }
714
-        elseif ($this->lower instanceof IComparable) {
694
+        } elseif ($this->lower instanceof IComparable) {
715 695
             if (!$this->lower->equals($object->lower)) {
716 696
                 return false;
717 697
             }
718
-        }
719
-        else {
698
+        } else {
720 699
             if ($this->lower != $object->lower) {
721 700
                 return false;
722 701
             }
@@ -726,13 +705,11 @@  discard block
 block discarded – undo
726 705
             if ($object->upper !== null) {
727 706
                 return false;
728 707
             }
729
-        }
730
-        elseif ($this->upper instanceof IComparable) {
708
+        } elseif ($this->upper instanceof IComparable) {
731 709
             if (!$this->upper->equals($object->upper)) {
732 710
                 return false;
733 711
             }
734
-        }
735
-        else {
712
+        } else {
736 713
             if ($this->upper != $object->upper) {
737 714
                 return false;
738 715
             }
@@ -754,11 +731,9 @@  discard block
 block discarded – undo
754 731
     {
755 732
         if ($offset == 0) {
756 733
             return ($this->empty ? null : $this->lower);
757
-        }
758
-        elseif ($offset == 1) {
734
+        } elseif ($offset == 1) {
759 735
             return ($this->empty ? null : $this->upper);
760
-        }
761
-        else {
736
+        } else {
762 737
             trigger_error("Undefined range offset: $offset", E_USER_WARNING);
763 738
             return null;
764 739
         }
Please login to merge, or discard this patch.
src/Ivory/Value/TextSearchQuery.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -38,11 +38,17 @@
 block discarded – undo
38 38
         return new TextSearchQuery($queryString);
39 39
     }
40 40
 
41
+    /**
42
+     * @param string $queryString
43
+     */
41 44
     private function __construct($queryString)
42 45
     {
43 46
         $this->queryString = $queryString;
44 47
     }
45 48
 
49
+    /**
50
+     * @return string
51
+     */
46 52
     public function toString()
47 53
     {
48 54
         return $this->queryString;
Please login to merge, or discard this patch.
src/Ivory/Value/TimeInterval.php 3 patches
Doc Comments   +10 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,6 +231,9 @@  discard block
 block discarded – undo
231 231
         return self::fromParts($parts);
232 232
     }
233 233
 
234
+    /**
235
+     * @param string $str
236
+     */
234 237
     private static function parseIsoDateStr($str)
235 238
     {
236 239
         if (preg_match('~^(-?\d+)-(-?\d+)-(-?\d+)$~', $str, $m)) {
@@ -284,6 +287,9 @@  discard block
 block discarded – undo
284 287
         }
285 288
     }
286 289
 
290
+    /**
291
+     * @param string $str
292
+     */
287 293
     private static function parsePostgresqlStr($str, $offset = 0)
288 294
     {
289 295
         static $pgUnits = [
@@ -341,6 +347,9 @@  discard block
 block discarded – undo
341 347
         return $parts;
342 348
     }
343 349
 
350
+    /**
351
+     * @param integer $offset
352
+     */
344 353
     private static function parseQuantityUnitPairs($str, $offset, $units)
345 354
     {
346 355
         $result = [];
@@ -450,7 +459,7 @@  discard block
 block discarded – undo
450 459
     /**
451 460
      * Multiplies this time interval with a scalar and returns the result as a new time interval object.
452 461
      *
453
-     * @param number $multiplier
462
+     * @param integer $multiplier
454 463
      * @return TimeInterval
455 464
      */
456 465
     public function multiply($multiplier)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
             preg_match_all('~(-?\d+(?:\.\d+)?)([YMDW])~', $str, $matches, PREG_SET_ORDER);
246 246
             static $units = ['Y' => self::YEAR, 'M' => self::MONTH, 'D' => self::DAY, 'W' => self::WEEK];
247 247
             foreach ($matches as $m) {
248
-                $parts[ $units[$m[2]] ] = (float)$m[1];
248
+                $parts[$units[$m[2]]] = (float)$m[1];
249 249
             }
250 250
             return $parts;
251 251
         }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             preg_match_all('~(-?\d+(?:\.\d+)?)([HMS])~', $str, $matches, PREG_SET_ORDER, $offset);
279 279
             static $units = ['H' => self::HOUR, 'M' => self::MINUTE, 'S' => self::SECOND];
280 280
             foreach ($matches as $m) {
281
-                $parts[ $units[$m[2]] ] = (float)$m[1];
281
+                $parts[$units[$m[2]]] = (float)$m[1];
282 282
             }
283 283
             return $parts;
284 284
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -198,20 +198,16 @@  discard block
 block discarded – undo
198 198
             $timeDelimPos = strpos($str, 'T');
199 199
             if (!$timeDelimPos) {
200 200
                 $parts = self::parseIsoDateStr(substr($str, 1));
201
-            }
202
-            elseif ($timeDelimPos == 1) {
201
+            } elseif ($timeDelimPos == 1) {
203 202
                 $parts = self::parseTimeStr($str, 2);
204
-            }
205
-            else {
203
+            } else {
206 204
                 $parts = self::parseIsoDateStr(substr($str, 1, $timeDelimPos - 1)) +
207 205
                     self::parseTimeStr($str, $timeDelimPos + 1);
208 206
             }
209
-        }
210
-        elseif ($str[0] == '@') {
207
+        } elseif ($str[0] == '@') {
211 208
             // verbose PostgreSQL format
212 209
             $parts = self::parsePostgresqlStr($str, 1);
213
-        }
214
-        elseif (preg_match('~^(?:(-)?(\d+)-(\d+))?\s*(-?\d+)??\s*(-?\d+(?::\d+(?::\d+(?:\.\d+)?)?)?)?$~', $str, $m)) {
210
+        } elseif (preg_match('~^(?:(-)?(\d+)-(\d+))?\s*(-?\d+)??\s*(-?\d+(?::\d+(?::\d+(?:\.\d+)?)?)?)?$~', $str, $m)) {
215 211
             // sql format
216 212
             $parts = (isset($m[5]) ? self::parseTimeStr($m[5], 0, false) : []);
217 213
             if (!empty($m[2]) || !empty($m[3])) {
@@ -222,8 +218,7 @@  discard block
 block discarded – undo
222 218
             if (!empty($m[4])) {
223 219
                 $parts[self::DAY] = (int)$m[4];
224 220
             }
225
-        }
226
-        else {
221
+        } else {
227 222
             // PostgreSQL format
228 223
             $parts = self::parsePostgresqlStr($str);
229 224
         }
@@ -239,8 +234,7 @@  discard block
 block discarded – undo
239 234
                 self::MONTH => (int)$m[2],
240 235
                 self::DAY => (int)$m[3],
241 236
             ];
242
-        }
243
-        else {
237
+        } else {
244 238
             $parts = [];
245 239
             preg_match_all('~(-?\d+(?:\.\d+)?)([YMDW])~', $str, $matches, PREG_SET_ORDER);
246 240
             static $units = ['Y' => self::YEAR, 'M' => self::MONTH, 'D' => self::DAY, 'W' => self::WEEK];
@@ -266,14 +260,12 @@  discard block
 block discarded – undo
266 260
                     self::MINUTE => $sgn * $m[2],
267 261
                     self::SECOND => $sgn * (isset($m[3]) ? (float)$m[3] : 0),
268 262
                 ];
269
-            }
270
-            else {
263
+            } else {
271 264
                 return [
272 265
                     self::SECOND => (float)$m[1],
273 266
                 ];
274 267
             }
275
-        }
276
-        else {
268
+        } else {
277 269
             $parts = [];
278 270
             preg_match_all('~(-?\d+(?:\.\d+)?)([HMS])~', $str, $matches, PREG_SET_ORDER, $offset);
279 271
             static $units = ['H' => self::HOUR, 'M' => self::MINUTE, 'S' => self::SECOND];
Please login to merge, or discard this patch.
src/Ivory/Value/TxIdSnapshot.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -56,6 +56,10 @@
 block discarded – undo
56 56
         return self::fromParts($parts[0], $parts[1], $xipList);
57 57
     }
58 58
 
59
+    /**
60
+     * @param integer $xmin
61
+     * @param integer $xmax
62
+     */
59 63
     private function __construct($xmin, $xmax, $xipList)
60 64
     {
61 65
         $this->xmin = $xmin;
Please login to merge, or discard this patch.
showcase/issues/mutability.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
 // VERSION 1: mutable relations
15 15
 
16 16
 foreach ($personRel as $row) {
17
-	print_r($row); // prints just the 'id', 'firstname', and 'lastname' attributes
17
+    print_r($row); // prints just the 'id', 'firstname', and 'lastname' attributes
18 18
 }
19 19
 
20 20
 
21 21
 // VERSION 2: immutable relations
22 22
 
23 23
 foreach ($personRel as $row) {
24
-	print_r($row); // prints the whole person row, not just the three attributes
24
+    print_r($row); // prints the whole person row, not just the three attributes
25 25
 }
26 26
 
27 27
 // VERSION 2a: the project() and similar methods copy the entire object into a new one
Please login to merge, or discard this patch.
showcase/issues/aliasing.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 $availPersonRel = new DbViewRelation('vw_avail_person', 'datatemplate');
16 16
 
17 17
 $sql = new StatementRelation(
18
-	"SELECT avail.room_id, %ln@p, 'the % sign is not expanded inside string literals'
18
+    "SELECT avail.room_id, %ln@p, 'the % sign is not expanded inside string literals'
19 19
 	 FROM % avail
20 20
 	      JOIN % p ON p.id = avail.person_id",
21
-	$personRel->project('id', 'firstname', 'lastname'),
22
-	$availPersonRel,
23
-	$personRel
21
+    $personRel->project('id', 'firstname', 'lastname'),
22
+    $availPersonRel,
23
+    $personRel
24 24
 );
25 25
 // "%ln" denotes a list of identifiers; in this case, it is fed with a relation, which causes to take all its attributes
26 26
 // the "@" sign denotes aliasing the relation of attributes
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 $availPersonRel = new DbViewRelation('vw_avail_person', 'datatemplate');
34 34
 
35 35
 $sql = new StatementRelation(
36
-	"SELECT avail.room_id, %ln, 'the % sign is not expanded inside string literals'
36
+    "SELECT avail.room_id, %ln, 'the % sign is not expanded inside string literals'
37 37
 	 FROM %
38 38
 	      JOIN % ON p.id = avail.person_id",
39
-	$personRel->project('id', 'firstname', 'lastname'),
40
-	$availPersonRel->aliased('avail'),
41
-	$personRel
39
+    $personRel->project('id', 'firstname', 'lastname'),
40
+    $availPersonRel->aliased('avail'),
41
+    $personRel
42 42
 );
43 43
 // "%ln" denotes a list of identifiers; in this case, it is fed with a relation, which causes to take all its attributes
Please login to merge, or discard this patch.
showcase/basic.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@
 block discarded – undo
9 9
 $joesRel = $personRel->findWhere('firstname = %', 'Joe'); // the percent sign for no conversion - take "string"
10 10
 
11 11
 foreach ($joesRel as $row) {
12
-	printf("%s %s\n", $row['firstname'], $row['lastname']);
12
+    printf("%s %s\n", $row['firstname'], $row['lastname']);
13 13
 }
14 14
 
15 15
 $joesName = $joesRel->project(['firstname', 'lastname', 'dateofbirth']); // project() limits the attributes to be fetched only to the listed ones
16 16
 foreach ($joesName as $i => $row) {
17
-	printf("%d: %s %s, born on %s\n",
18
-		$i, $row['firstname'], $row['lastname'], $row['dateofbirth']->format('Y-m-d')
19
-	);
17
+    printf("%d: %s %s, born on %s\n",
18
+        $i, $row['firstname'], $row['lastname'], $row['dateofbirth']->format('Y-m-d')
19
+    );
20 20
 }
21 21
 
22 22
 $joeRows = $joesRel->map('id'); // fetch all columns, map by id
23 23
 foreach ($joeRows as $id => $row) {
24
-	printf("person #%d:\n", $id);
25
-	foreach ($row as $field => $value) {
26
-		printf("  %s => %s\n", $field, $value);
27
-	}
24
+    printf("person #%d:\n", $id);
25
+    foreach ($row as $field => $value) {
26
+        printf("  %s => %s\n", $field, $value);
27
+    }
28 28
 }
29 29
 
30 30
 $joesLastnameMap = $joesRel->map('id', 'lastname'); // fetch a map of person ids to lastnames
31 31
 foreach ($joesLastnameMap as $id => $lastname) {
32
-	printf("%d: %s\n", $id, $lastname);
32
+    printf("%d: %s\n", $id, $lastname);
33 33
 }
34 34
 
35 35
 $joesRowMap = $joesRel->map('id', ['firstname', 'lastname', 'dateofbirth']); // fetch a map of person ids to rows containing the person firstname, lastname, and date of birth
36 36
 foreach ($joesRowMap as $id => $row) {
37
-	printf("%d: %s %s, born on %s\n",
38
-		$id, $row['firstname'], $row['lastname'], $row['dateofbirth']->format('Y-m-d')
39
-	);
37
+    printf("%d: %s %s, born on %s\n",
38
+        $id, $row['firstname'], $row['lastname'], $row['dateofbirth']->format('Y-m-d')
39
+    );
40 40
 }
Please login to merge, or discard this patch.
showcase/sql.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,53 +12,53 @@
 block discarded – undo
12 12
 $roomIds = [3, 4, 5];
13 13
 
14 14
 $sql = new StatementRelation(
15
-	"SELECT avail.room_id, %ln@p, 'the % sign is not expanded inside string literals'
15
+    "SELECT avail.room_id, %ln@p, 'the % sign is not expanded inside string literals'
16 16
 	 FROM % avail
17 17
 	      JOIN % p ON p.id = avail.person_id
18 18
 	 WHERE avail.room_id IN (%l) AND p.id IN (%l)
19 19
 	 ORDER BY avail.room_id, p.lastname, p.firstname",
20
-	$personRel->project('id', 'firstname', 'lastname'), // limit the person relation only to these attributes
21
-	$availPersonRel, // the real power comes in: any relation shall be applicable in the query
22
-	$personRel,
23
-	$roomIds, $employeeIds
20
+    $personRel->project('id', 'firstname', 'lastname'), // limit the person relation only to these attributes
21
+    $availPersonRel, // the real power comes in: any relation shall be applicable in the query
22
+    $personRel,
23
+    $roomIds, $employeeIds
24 24
 );
25 25
 // "%l" generally means a list of something; another formatting token may follow, specifying the list subtype
26 26
 // the list subtype may be omitted to use the identity conversion, just like for any argument
27 27
 // here, "%ln" denotes a list of identifiers; in this case, it is fed with a relation, which causes to take all its (three) attributes
28 28
 // the "@" sign denotes aliasing the relation of attributes
29 29
 foreach ($sql as $row) {
30
-	printf("%s %s available for room #%d\n", $row['firstname'], $row['lastname'], $row['room_id']);
30
+    printf("%s %s available for room #%d\n", $row['firstname'], $row['lastname'], $row['room_id']);
31 31
 }
32 32
 
33 33
 
34 34
 class PersonRole extends DbTableRelation
35 35
 {
36
-	public function __construct()
37
-	{
38
-		parent::__construct('person_role');
39
-	}
36
+    public function __construct()
37
+    {
38
+        parent::__construct('person_role');
39
+    }
40 40
 }
41 41
 
42 42
 class Role extends DbTableRelation
43 43
 {
44
-	const ADMIN = 1;
44
+    const ADMIN = 1;
45 45
 
46
-	public function __construct()
47
-	{
48
-		parent::__construct('role');
49
-	}
46
+    public function __construct()
47
+    {
48
+        parent::__construct('role');
49
+    }
50 50
 }
51 51
 
52 52
 $adminInfo = $personRel->project([
53
-	'id',
54
-	'fname' => 'firstname',
55
-	'lastname' => 'UPPER(lastname)',
56
-	'is_admin' => new Statement("EXISTS(SELECT 1 FROM %n WHERE role = %)", PersonRole::class, Role::ADMIN), // unfortunately, PHP implements ::class as mere string, not an object of a special class, thus, the explicit %n must be used
53
+    'id',
54
+    'fname' => 'firstname',
55
+    'lastname' => 'UPPER(lastname)',
56
+    'is_admin' => new Statement("EXISTS(SELECT 1 FROM %n WHERE role = %)", PersonRole::class, Role::ADMIN), // unfortunately, PHP implements ::class as mere string, not an object of a special class, thus, the explicit %n must be used
57 57
 ]);
58 58
 foreach ($adminInfo as $row) {
59
-	echo $row['fname'] . ' ' . $row['lastname'];
60
-	if ($row['is_admin']) {
61
-		echo ' is admin';
62
-	}
63
-	echo "\n";
59
+    echo $row['fname'] . ' ' . $row['lastname'];
60
+    if ($row['is_admin']) {
61
+        echo ' is admin';
62
+    }
63
+    echo "\n";
64 64
 }
Please login to merge, or discard this patch.