Passed
Push — master ( d0e3c7...49353d )
by Alexander
02:03
created
src/Collection/PrioritizedObjectList.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Weblabltd\Component\Util\Collection;
6 6
 
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @var array
16 16
      */
17
-    private $objects = [];
17
+    private $objects = [ ];
18 18
     /**
19 19
      * @var array
20 20
      */
21
-    private $indexes = [];
21
+    private $indexes = [ ];
22 22
     /**
23 23
      * @var int
24 24
      */
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
         $index = spl_object_hash($object);
56 56
 
57
-        if (!isset($this->objects[$index])) {
58
-            $this->objects[$index] = [$object, [$priority ?? static::DEFAULT_PRIORITY, $this->serial--]];
59
-            $this->indexes[]       = $index;
57
+        if (!isset($this->objects[ $index ])) {
58
+            $this->objects[ $index ] = [ $object, [ $priority ?? static::DEFAULT_PRIORITY, $this->serial-- ] ];
59
+            $this->indexes[ ]       = $index;
60 60
         } else {
61 61
             // if object is present just override it's priority
62
-            $this->objects[$index][1][0] = $priority ?? static::DEFAULT_PRIORITY;
62
+            $this->objects[ $index ][ 1 ][ 0 ] = $priority ?? static::DEFAULT_PRIORITY;
63 63
         }
64 64
 
65 65
         // mark as not sorted
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $this->sort();
85 85
 
86
-        if (!isset($this->indexes[$this->cursor])) {
86
+        if (!isset($this->indexes[ $this->cursor ])) {
87 87
             throw new \OutOfBoundsException('There is no object at the current position');
88 88
         }
89 89
 
90
-        return $this->objects[$this->indexes[$this->cursor]][0];
90
+        return $this->objects[ $this->indexes[ $this->cursor ] ][ 0 ];
91 91
     }
92 92
 
93 93
     /**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $this->sort();
119 119
 
120
-        return isset($this->indexes[$this->cursor]);
120
+        return isset($this->indexes[ $this->cursor ]);
121 121
     }
122 122
 
123 123
     /**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
             return;
140 140
         }
141 141
 
142
-        uasort($this->objects, function ($o1, $o2) {
143
-            return $o2[1][0] <=> $o1[1][0];
142
+        uasort($this->objects, function($o1, $o2) {
143
+            return $o2[ 1 ][ 0 ] <=> $o1[ 1 ][ 0 ];
144 144
         });
145 145
 
146 146
         $this->indexes = array_keys($this->objects);
Please login to merge, or discard this patch.