Passed
Branch master (f3ba86)
by Smoren
14:25 queued 12:29
created
Category
src/Structs/LinkedListItem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,11 +124,11 @@
 block discarded – undo
124 124
      */
125 125
     public function __clone()
126 126
     {
127
-        if(is_object($this->data)) {
127
+        if (is_object($this->data)) {
128 128
             $this->data = clone $this->data;
129 129
         }
130 130
 
131
-        if(is_object($this->extra)) {
131
+        if (is_object($this->extra)) {
132 132
             $this->extra = clone $this->extra;
133 133
         }
134 134
 
Please login to merge, or discard this patch.
src/Structs/GraphLink.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
      */
98 98
     public function toArray(bool $itemIdsOnly = false): array
99 99
     {
100
-        if($itemIdsOnly) {
100
+        if ($itemIdsOnly) {
101 101
             return [$this->leftItem->getId(), $this->rightItem->getId(), $this->type];
102 102
         }
103 103
 
Please login to merge, or discard this patch.
src/Structs/SortedMappedLinkedList.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function __construct($input = [])
34 34
     {
35
-        if($input instanceof MappedLinkedList) {
35
+        if ($input instanceof MappedLinkedList) {
36 36
             $this->list = $input;
37
-        } elseif(is_array($input)) {
37
+        } elseif (is_array($input)) {
38 38
             $this->list = new MappedLinkedList($input);
39 39
         } else {
40 40
             $linkedListType = MappedLinkedList::class;
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
     {
203 203
         $position = null;
204 204
         $possiblePosition = new LinkedListItem($data, null, null, $id);
205
-        foreach($this->list as $id => $val) {
206
-            if(!($this->comparator)($data, $val, $possiblePosition, $this->getPosition($id))) {
205
+        foreach ($this->list as $id => $val) {
206
+            if (!($this->comparator)($data, $val, $possiblePosition, $this->getPosition($id))) {
207 207
                 break;
208 208
             }
209 209
             $position = $id;
Please login to merge, or discard this patch.
src/Structs/LinkedList.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $result = new LinkedList();
37 37
 
38
-        foreach($lists as $list) {
39
-            foreach($list as $value) {
38
+        foreach ($lists as $list) {
39
+            foreach ($list as $value) {
40 40
                 $result->pushBack($value);
41 41
             }
42 42
         }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function __construct(array $input = [])
52 52
     {
53
-        foreach($input as $item) {
53
+        foreach ($input as $item) {
54 54
             $this->pushBack($item);
55 55
         }
56 56
     }
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $newItem = new LinkedListItem($data, null, null);
87 87
 
88
-        if($item === null) {
89
-            if($this->first !== null) {
88
+        if ($item === null) {
89
+            if ($this->first !== null) {
90 90
                 return $this->pushBefore($this->first, $data);
91 91
             }
92 92
             $this->first = $newItem;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $newItem->setPrev($item);
98 98
             $newItem->setNext($bufNext);
99 99
 
100
-            if($bufNext === null) {
100
+            if ($bufNext === null) {
101 101
                 $this->last = $newItem;
102 102
             } else {
103 103
                 $bufNext->setPrev($newItem);
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $newItem = new LinkedListItem($data, null, null);
121 121
 
122
-        if($item === null) {
123
-            if($this->last !== null) {
122
+        if ($item === null) {
123
+            if ($this->last !== null) {
124 124
                 return $this->pushAfter($this->last, $data);
125 125
             }
126 126
             $this->first = $newItem;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $newItem->setNext($item);
132 132
             $newItem->setPrev($bufPrev);
133 133
 
134
-            if($bufPrev === null) {
134
+            if ($bufPrev === null) {
135 135
                 $this->first = $newItem;
136 136
             } else {
137 137
                 $bufPrev->setNext($newItem);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function popFront()
152 152
     {
153
-        if(!$this->length) {
153
+        if (!$this->length) {
154 154
             throw new LinkedListException('empty', LinkedListException::STATUS_EMPTY);
155 155
         }
156 156
         return $this->popFrontPosition()->getData();
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function popFrontPosition(): LinkedListItem
175 175
     {
176
-        if(!$this->length) {
176
+        if (!$this->length) {
177 177
             throw new LinkedListException('empty', LinkedListException::STATUS_EMPTY);
178 178
         }
179 179
         return $this->delete($this->first);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function popBackPosition(): LinkedListItem
188 188
     {
189
-        if(!$this->length) {
189
+        if (!$this->length) {
190 190
             throw new LinkedListException('empty', LinkedListException::STATUS_EMPTY);
191 191
         }
192 192
         return $this->delete($this->last);
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
         $prev = $item->getPrev();
203 203
         $next = $item->getNext();
204 204
 
205
-        if($prev !== null) {
205
+        if ($prev !== null) {
206 206
             $prev->setNext($next);
207 207
         } else {
208 208
             $this->first = $next;
209 209
         }
210 210
 
211
-        if($next !== null) {
211
+        if ($next !== null) {
212 212
             $next->setPrev($prev);
213 213
         } else {
214 214
             $this->last = $prev;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $rhsPrev = $rhs->getPrev();
233 233
         $rhsNext = $rhs->getNext();
234 234
 
235
-        if($lhsNext === $rhs) {
235
+        if ($lhsNext === $rhs) {
236 236
             $rhs->setNext($lhs);
237 237
             $lhs->setPrev($rhs);
238 238
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
             $lhs->setNext($rhsNext);
243 243
             $this->setPrevFor($rhsNext, $lhs);
244
-        } elseif($rhsNext === $lhs) {
244
+        } elseif ($rhsNext === $lhs) {
245 245
             $lhs->setNext($rhs);
246 246
             $rhs->setPrev($lhs);
247 247
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     public function sort(callable $comparator): self
291 291
     {
292
-        if($this->length <= 1) {
292
+        if ($this->length <= 1) {
293 293
             return $this;
294 294
         }
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             $flagStop = true;
298 298
             $it = $this->getIterator();
299 299
             $it->rewind();
300
-            for($i=0; $i<$this->length-1; $i++) {
300
+            for ($i = 0; $i < $this->length-1; $i++) {
301 301
                 $lhs = $it->current();
302 302
                 /** @var LinkedListItem $lhsItem */
303 303
                 $lhsItem = $it->key();
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
                 /** @var LinkedListItem $rhsItem */
308 308
                 $rhsItem = $it->key();
309 309
 
310
-                if($comparator($lhs, $rhs, $lhsItem, $rhsItem)) {
310
+                if ($comparator($lhs, $rhs, $lhsItem, $rhsItem)) {
311 311
                     $this->swap($lhsItem, $rhsItem);
312 312
                     $flagStop = false;
313 313
                 }
314 314
             }
315
-        } while(!$flagStop);
315
+        } while (!$flagStop);
316 316
 
317 317
         return $this;
318 318
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     public function toArray(): array
325 325
     {
326 326
         $result = [];
327
-        foreach($this as $val) {
327
+        foreach ($this as $val) {
328 328
             $result[] = $val;
329 329
         }
330 330
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     protected function setPrevFor(?LinkedListItem $positionFor, LinkedListItem $element): self
377 377
     {
378
-        if($positionFor !== null) {
378
+        if ($positionFor !== null) {
379 379
             $positionFor->setPrev($element);
380 380
         } else {
381 381
             $this->last = $element;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
      */
393 393
     protected function setNextFor(?LinkedListItem $positionFor, LinkedListItem $element): self
394 394
     {
395
-        if($positionFor !== null) {
395
+        if ($positionFor !== null) {
396 396
             $positionFor->setNext($element);
397 397
         } else {
398 398
             $this->first = $element;
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
     {
410 410
         $result = [];
411 411
 
412
-        foreach($this as $pos => $val) {
413
-            if(is_callable($mapper)) {
412
+        foreach ($this as $pos => $val) {
413
+            if (is_callable($mapper)) {
414 414
                 $result[$mapper($pos)] = $pos;
415 415
             } else {
416 416
                 $result[] = $pos;
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
     public function getIndexOf(LinkedListItem $position): int
429 429
     {
430 430
         $index = 0;
431
-        foreach($this as $pos => $val) {
432
-            if($position === $pos) {
431
+        foreach ($this as $pos => $val) {
432
+            if ($position === $pos) {
433 433
                 break;
434 434
             }
435 435
             ++$index;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function checkIntegrity(): self
447 447
     {
448
-        if($this->first->getPrev() !== null) {
448
+        if ($this->first->getPrev() !== null) {
449 449
             throw new LinkedListException(
450 450
                 'integrity violation',
451 451
                 LinkedListException::STATUS_INTEGRITY_VIOLATION,
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
             );
460 460
         }
461 461
 
462
-        if($this->last->getNext() !== null) {
462
+        if ($this->last->getNext() !== null) {
463 463
             throw new LinkedListException(
464 464
                 'integrity violation',
465 465
                 LinkedListException::STATUS_INTEGRITY_VIOLATION,
@@ -475,9 +475,9 @@  discard block
 block discarded – undo
475 475
 
476 476
         $objMap = [];
477 477
         $index = 0;
478
-        foreach($this as $pos => $val) {
478
+        foreach ($this as $pos => $val) {
479 479
             $objId = spl_object_id($pos);
480
-            if(isset($objMap[$objId])) {
480
+            if (isset($objMap[$objId])) {
481 481
                 throw new LinkedListException(
482 482
                     'integrity violation',
483 483
                     LinkedListException::STATUS_INTEGRITY_VIOLATION,
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     public function __clone()
504 504
     {
505 505
         $buf = [];
506
-        foreach($this as $pos => $val) {
506
+        foreach ($this as $pos => $val) {
507 507
             $buf[] = clone $pos;
508 508
         }
509 509
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             $rhs->setPrev($lhs);
513 513
         });
514 514
 
515
-        if(count($buf)) {
515
+        if (count($buf)) {
516 516
             $this->first = $buf[0];
517 517
             $this->last = $buf[count($buf)-1];
518 518
         }
Please login to merge, or discard this patch.
src/Structs/MappedCollection.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
     {
93 93
         try {
94 94
             $this->checkExist($id);
95
-        } catch(MappedCollectionException $e) {
96
-            if($default !== null) {
95
+        } catch (MappedCollectionException $e) {
96
+            if ($default !== null) {
97 97
                 return $default;
98 98
             } else {
99 99
                 throw $e;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function checkExist(string $id): self
123 123
     {
124
-        if(!$this->exist($id)) {
124
+        if (!$this->exist($id)) {
125 125
             throw new MappedCollectionException(
126 126
                 "ID '{$id}' not exists",
127 127
                 MappedCollectionException::STATUS_ID_NOT_EXIST
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function checkNotExist(string $id): self
140 140
     {
141
-        if($this->exist($id)) {
141
+        if ($this->exist($id)) {
142 142
             throw new MappedCollectionException(
143 143
                 "ID '{$id}' exists",
144 144
                 MappedCollectionException::STATUS_ID_EXIST
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $itemsMap = $this->itemsMap;
211 211
         $this->itemsMap = [];
212
-        foreach($itemsMap as $id => $value) {
213
-            if(is_object($value)) {
212
+        foreach ($itemsMap as $id => $value) {
213
+            if (is_object($value)) {
214 214
                 $this->itemsMap[$id] = clone $value;
215 215
             } else {
216 216
                 $this->itemsMap[$id] = $value;
Please login to merge, or discard this patch.
src/Structs/SortedLinkedList.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function __construct($input = [])
29 29
     {
30
-        if($input instanceof LinkedList) {
30
+        if ($input instanceof LinkedList) {
31 31
             $this->list = $input;
32
-        } elseif(is_array($input)) {
32
+        } elseif (is_array($input)) {
33 33
             $this->list = new LinkedList($input);
34 34
         } else {
35 35
             $linkedListType = LinkedList::class;
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
     protected function findLeftPosition($data): ?LinkedListItem
155 155
     {
156 156
         $position = null;
157
-        foreach($this->list as $pos => $val) {
158
-            if(!($this->comparator)($data, $val)) {
157
+        foreach ($this->list as $pos => $val) {
158
+            if (!($this->comparator)($data, $val)) {
159 159
                 break;
160 160
             }
161 161
             $position = $pos;
Please login to merge, or discard this patch.
src/Structs/MappedLinkedList.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $result = new MappedLinkedList();
32 32
 
33
-        foreach($lists as $list) {
34
-            foreach($list as $id => $value) {
33
+        foreach ($lists as $list) {
34
+            foreach ($list as $id => $value) {
35 35
                 $result->pushBack($id, $value);
36 36
             }
37 37
         }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $this->list = $listObject ?? new LinkedList();
55 55
         $this->positionsMap = $positionMap ?? new MappedCollection();
56 56
 
57
-        foreach($inputMap as $id => $value) {
57
+        foreach ($inputMap as $id => $value) {
58 58
             $this->pushBack($id, $value);
59 59
         }
60 60
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function pushAfter(?string $idAfter, string $id, $data): LinkedListItem
107 107
     {
108
-        if($idAfter !== null) {
108
+        if ($idAfter !== null) {
109 109
             $this->checkExist($idAfter);
110 110
             $position = $this->positionsMap->get($idAfter);
111 111
         } else {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function pushBefore(?string $idBefore, string $id, $data): LinkedListItem
131 131
     {
132
-        if($idBefore !== null) {
132
+        if ($idBefore !== null) {
133 133
             $this->checkExist($idBefore);
134 134
             $position = $this->positionsMap->get($idBefore);
135 135
         } else {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
          * @var LinkedListItem $position
267 267
          * @var mixed $value
268 268
          */
269
-        foreach($this->list as $position => $value) {
269
+        foreach ($this->list as $position => $value) {
270 270
             $result[$position->getExtra()] = $value;
271 271
         }
272 272
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function checkExist(string $id): self
293 293
     {
294
-        if(!$this->exist($id)) {
294
+        if (!$this->exist($id)) {
295 295
             throw new MappedLinkedListException(
296 296
                 "ID '{$id}' not exists",
297 297
                 MappedLinkedListException::STATUS_ID_NOT_EXIST
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function checkNotExist(string $id): self
310 310
     {
311
-        if($this->exist($id)) {
311
+        if ($this->exist($id)) {
312 312
             throw new MappedLinkedListException(
313 313
                 "ID '{$id}' exists",
314 314
                 MappedLinkedListException::STATUS_ID_EXIST
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function checkNotEmpty(): self
326 326
     {
327
-        if(!$this->count()) {
327
+        if (!$this->count()) {
328 328
             throw new MappedLinkedListException(
329 329
                 "collection is empty",
330 330
                 MappedLinkedListException::STATUS_EMPTY
Please login to merge, or discard this patch.
src/Structs/GraphItem.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function getPrevItem(string $id, string $type): GraphItem
85 85
     {
86
-        if(!isset($this->prevItemMap[$type][$id])) {
86
+        if (!isset($this->prevItemMap[$type][$id])) {
87 87
             throw new GraphException(
88 88
                 "ID '{$id}' not exists",
89 89
                 GraphException::STATUS_ID_NOT_EXIST
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $result = [];
105 105
 
106
-        if($type === null) {
107
-            foreach($this->prevItemMap as $itemMap) {
108
-                foreach($itemMap as $itemId => $item) {
106
+        if ($type === null) {
107
+            foreach ($this->prevItemMap as $itemMap) {
108
+                foreach ($itemMap as $itemId => $item) {
109 109
                     $result[$itemId] = $item;
110 110
                 }
111 111
             }
112 112
         } else {
113
-            if(!isset($this->prevItemMap[$type])) {
113
+            if (!isset($this->prevItemMap[$type])) {
114 114
                 throw new GraphException(
115 115
                     "type '{$type}' not exist",
116 116
                     GraphException::STATUS_TYPE_NOT_EXIST
117 117
                 );
118 118
             }
119 119
 
120
-            foreach($this->prevItemMap[$type] as $itemId => $item) {
120
+            foreach ($this->prevItemMap[$type] as $itemId => $item) {
121 121
                 $result[$itemId] = $item;
122 122
             }
123 123
         }
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $result = [];
137 137
 
138
-        foreach($this->prevItemMap as $type => $itemMap) {
139
-            if(
138
+        foreach ($this->prevItemMap as $type => $itemMap) {
139
+            if (
140 140
                 $typesOnly !== null && !in_array($type, $typesOnly) ||
141 141
                 $typesExclude !== null && in_array($type, $typesExclude)
142 142
             ) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             }
145 145
 
146 146
             $result[$type] = [];
147
-            foreach($itemMap as $itemId => $item) {
147
+            foreach ($itemMap as $itemId => $item) {
148 148
                 $result[$type][] = $itemId;
149 149
             }
150 150
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $itemId = $item->getId();
164 164
 
165
-        if(!isset($this->prevItemMap[$type])) {
165
+        if (!isset($this->prevItemMap[$type])) {
166 166
             $this->prevItemMap[$type] = [];
167 167
         }
168 168
 
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function deletePrevItem(string $itemId, ?string $type = null): self
181 181
     {
182
-        if($type === null) {
183
-            foreach($this->prevItemMap as $type => $itemMap) {
182
+        if ($type === null) {
183
+            foreach ($this->prevItemMap as $type => $itemMap) {
184 184
                 $this->deletePrevItem($itemId, $type);
185 185
             }
186 186
 
187 187
             return $this;
188 188
         }
189 189
 
190
-        if(isset($this->prevItemMap[$type][$itemId])) {
190
+        if (isset($this->prevItemMap[$type][$itemId])) {
191 191
             unset($this->prevItemMap[$type][$itemId]);
192 192
 
193
-            if(!count($this->prevItemMap[$type])) {
193
+            if (!count($this->prevItemMap[$type])) {
194 194
                 unset($this->prevItemMap[$type]);
195 195
             }
196 196
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public function getNextItem(string $id, string $type): GraphItem
209 209
     {
210
-        if(!isset($this->nextItemMap[$type][$id])) {
210
+        if (!isset($this->nextItemMap[$type][$id])) {
211 211
             throw new GraphException(
212 212
                 "ID '{$id}' not exists",
213 213
                 GraphException::STATUS_ID_NOT_EXIST
@@ -227,21 +227,21 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $result = [];
229 229
 
230
-        if($type === null) {
231
-            foreach($this->nextItemMap as $itemMap) {
232
-                foreach($itemMap as $itemId => $item) {
230
+        if ($type === null) {
231
+            foreach ($this->nextItemMap as $itemMap) {
232
+                foreach ($itemMap as $itemId => $item) {
233 233
                     $result[$itemId] = $item;
234 234
                 }
235 235
             }
236 236
         } else {
237
-            if(!isset($this->nextItemMap[$type])) {
237
+            if (!isset($this->nextItemMap[$type])) {
238 238
                 throw new GraphException(
239 239
                     "type '{$type}' not exist",
240 240
                     GraphException::STATUS_TYPE_NOT_EXIST
241 241
                 );
242 242
             }
243 243
 
244
-            foreach($this->nextItemMap[$type] as $itemId => $item) {
244
+            foreach ($this->nextItemMap[$type] as $itemId => $item) {
245 245
                 $result[$itemId] = $item;
246 246
             }
247 247
         }
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
     {
260 260
         $result = [];
261 261
 
262
-        foreach($this->nextItemMap as $type => $itemMap) {
263
-            if(
262
+        foreach ($this->nextItemMap as $type => $itemMap) {
263
+            if (
264 264
                 $typesOnly !== null && !in_array($type, $typesOnly) ||
265 265
                 $typesExclude !== null && in_array($type, $typesExclude)
266 266
             ) {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             }
269 269
 
270 270
             $result[$type] = [];
271
-            foreach($itemMap as $itemId => $item) {
271
+            foreach ($itemMap as $itemId => $item) {
272 272
                 $result[$type][] = $itemId;
273 273
             }
274 274
         }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     {
287 287
         $itemId = $item->getId();
288 288
 
289
-        if(!isset($this->nextItemMap[$type])) {
289
+        if (!isset($this->nextItemMap[$type])) {
290 290
             $this->nextItemMap[$type] = [];
291 291
         }
292 292
 
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
      */
304 304
     public function deleteNextItem(string $itemId, ?string $type = null): self
305 305
     {
306
-        if($type === null) {
307
-            foreach($this->nextItemMap as $type => $itemMap) {
306
+        if ($type === null) {
307
+            foreach ($this->nextItemMap as $type => $itemMap) {
308 308
                 $this->deleteNextItem($itemId, $type);
309 309
             }
310 310
 
311 311
             return $this;
312 312
         }
313 313
 
314
-        if(isset($this->nextItemMap[$type][$itemId])) {
314
+        if (isset($this->nextItemMap[$type][$itemId])) {
315 315
             unset($this->nextItemMap[$type][$itemId]);
316 316
 
317
-            if(!count($this->nextItemMap[$type])) {
317
+            if (!count($this->nextItemMap[$type])) {
318 318
                 unset($this->nextItemMap[$type]);
319 319
             }
320 320
         }
Please login to merge, or discard this patch.
src/Structs/GraphTraversePath.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function reverse(bool $clone = false, bool $cloneItems = false): self
50 50
     {
51
-        if($clone) {
51
+        if ($clone) {
52 52
             $path = clone $this;
53 53
         } else {
54 54
             $path = $this;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         $path->links = array_reverse($path->links);
58 58
 
59
-        foreach($path->links as $link) {
59
+        foreach ($path->links as $link) {
60 60
             $link->swap($cloneItems);
61 61
         }
62 62
 
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $result = [];
91 91
 
92
-        foreach($this->links as $link) {
93
-            if($itemIdsOnly) {
92
+        foreach ($this->links as $link) {
93
+            if ($itemIdsOnly) {
94 94
                 $result[] = $link->getLeftItem()->getId();
95 95
             } else {
96 96
                 $result[] = $link->toArray();
97 97
             }
98 98
         }
99 99
 
100
-        if($itemIdsOnly && isset($link)) {
100
+        if ($itemIdsOnly && isset($link)) {
101 101
             $result[] = $link->getRightItem()->getId();
102 102
         }
103 103
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function __clone()
111 111
     {
112
-        foreach($this->links as $i => $link) {
112
+        foreach ($this->links as $i => $link) {
113 113
             $this->links[$i] = clone $link;
114 114
         }
115 115
     }
Please login to merge, or discard this patch.