Completed
Branch master (1c63cf)
by Jakub
04:17
created
Category
src/TCollection.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Utils;
5 5
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
    * @throws \OutOfRangeException
44 44
    */
45 45
   function offsetGet($index) {
46
-    if($index < 0 OR $index >= count($this->items)) {
46
+    if ($index < 0 OR $index >= count($this->items)) {
47 47
       throw new \OutOfRangeException("Offset invalid or out of range.");
48 48
     }
49 49
     return $this->items[$index];
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
    * @return bool
55 55
    */
56 56
   protected function checkUniqueness($newItem): bool {
57
-    if(is_null($this->uniqueProperty)) {
57
+    if (is_null($this->uniqueProperty)) {
58 58
       return true;
59 59
     }
60
-    foreach($this as $item) {
61
-      if($newItem->{$this->uniqueProperty} === $item->{$this->uniqueProperty}) {
60
+    foreach ($this as $item) {
61
+      if ($newItem->{$this->uniqueProperty} === $item->{$this->uniqueProperty}) {
62 62
         return false;
63 63
       }
64 64
     }
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
    * @throws \InvalidArgumentException
74 74
    */
75 75
   function offsetSet($index, $item): void {
76
-    if(!$item instanceof $this->class) {
76
+    if (!$item instanceof $this->class) {
77 77
       throw new \InvalidArgumentException("Argument must be of $this->class type.");
78
-    } elseif(!$this->checkUniqueness($item)) {
78
+    } elseif (!$this->checkUniqueness($item)) {
79 79
       $property = $this->uniqueProperty;
80 80
       throw new \RuntimeException("Duplicate $property {$item->$property}.");
81 81
     }
82
-    if($index === NULL) {
82
+    if ($index === NULL) {
83 83
       $this->items[] = & $item;
84
-    } elseif($index < 0 OR $index >= count($this->items)) {
84
+    } elseif ($index < 0 OR $index >= count($this->items)) {
85 85
       throw new \OutOfRangeException("Offset invalid or out of range.");
86 86
     } else {
87 87
       $this->items[$index] = & $item;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
    * @throws \OutOfRangeException
95 95
    */
96 96
   function offsetUnset($index): void {
97
-    if($index < 0 OR $index >= count($this->items)) {
97
+    if ($index < 0 OR $index >= count($this->items)) {
98 98
       throw new \OutOfRangeException("Offset invalid or out of range.");
99 99
     }
100 100
     array_splice($this->items, $index, 1);
Please login to merge, or discard this patch.
src/Intervals.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Utils;
5 5
 
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
    * @param string $text
20 20
    * @return string|NULL
21 21
    */
22
-  static function findInterval(string $text): ?string {
22
+  static function findInterval(string $text): ? string {
23 23
     $found = preg_match_all(static::PATTERN, $text, $result);
24
-    if(!$found) {
24
+    if (!$found) {
25 25
       return NULL;
26 26
     }
27 27
     return $result[0][0];
28 28
   }
29 29
   
30 30
   static function isInInterval(int $number, string $interval): bool {
31
-    if(is_null(static::findInterval($interval)) OR $interval !== static::findInterval($interval)) {
31
+    if (is_null(static::findInterval($interval)) OR $interval !== static::findInterval($interval)) {
32 32
       return false;
33 33
     }
34
-    if(Strings::startsWith($interval, "{")) {
34
+    if (Strings::startsWith($interval, "{")) {
35 35
       $numbers = explode(",", Strings::trim($interval, "{}"));
36 36
       return (in_array($number, $numbers));
37 37
     }
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
     $end = $matches["end"][0];
41 41
     $limit1 = (int) str_replace("-Inf", PHP_INT_MIN, $matches["limit1"][0]);
42 42
     $limit2 = (int) str_replace("+Inf", PHP_INT_MAX, $matches["limit2"][0]);
43
-    if($limit1 > $limit2) {
43
+    if ($limit1 > $limit2) {
44 44
       return false;
45
-    } elseif($number < $limit1) {
45
+    } elseif ($number < $limit1) {
46 46
       return false;
47
-    } elseif($number > $limit2) {
47
+    } elseif ($number > $limit2) {
48 48
       return false;
49
-    } elseif($number === $limit1 AND $start === "]") {
49
+    } elseif ($number === $limit1 AND $start === "]") {
50 50
       return false;
51
-    } elseif($number === $limit2 AND $end === "[") {
51
+    } elseif ($number === $limit2 AND $end === "[") {
52 52
       return false;
53 53
     }
54 54
     return true;
Please login to merge, or discard this patch.
src/Collection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Utils;
5 5
 
Please login to merge, or discard this patch.