@@ -132,31 +132,31 @@ public function extract()
132
132
*/
133
133
public function remove ($ datum )
134
134
{
135
- $ currentIndex = $ this ->index ;
136
- $ currentSubIndex = $ this ->subIndex ;
137
- $ currentPriority = $ this ->maxPriority ;
138
-
135
+ $ currentIndex = $ this ->index ;
136
+ $ currentSubIndex = $ this ->subIndex ;
137
+ $ currentPriority = $ this ->maxPriority ;
138
+
139
139
$ this ->rewind ();
140
140
while ($ this ->valid ()) {
141
141
if (current ($ this ->values [$ this ->maxPriority ]) === $ datum ) {
142
142
$ index = key ($ this ->values [$ this ->maxPriority ]);
143
143
unset($ this ->values [$ this ->maxPriority ][$ index ]);
144
-
144
+
145
145
// The `next()` method advances the internal array pointer, so we need to use the `reset()` function,
146
146
// otherwise we would lose all elements before the place the pointer points.
147
147
reset ($ this ->values [$ this ->maxPriority ]);
148
-
148
+
149
149
$ this ->index = $ currentIndex ;
150
150
$ this ->subIndex = $ currentSubIndex ;
151
-
151
+
152
152
// If the array is empty we need to destroy the unnecessary priority,
153
153
// otherwise we would end up with an incorrect value of `$this->count` {@see \Zend\Stdlib\FastPriorityQueue::nextAndRemove()}.
154
154
if (empty ($ this ->values [$ this ->maxPriority ])) {
155
- unset($ this ->values [$ this ->maxPriority ]);
156
- unset($ this ->priorities [$ this ->maxPriority ]);
157
- if ($ this ->maxPriority === $ currentPriority ) {
158
- $ this ->subIndex = 0 ;
159
- }
155
+ unset($ this ->values [$ this ->maxPriority ]);
156
+ unset($ this ->priorities [$ this ->maxPriority ]);
157
+ if ($ this ->maxPriority === $ currentPriority ) {
158
+ $ this ->subIndex = 0 ;
159
+ }
160
160
}
161
161
162
162
$ this ->maxPriority = empty ($ this ->priorities ) ? null : max ($ this ->priorities );
@@ -214,15 +214,15 @@ public function key()
214
214
*/
215
215
protected function nextAndRemove ()
216
216
{
217
- $ key = key ($ this ->values [$ this ->maxPriority ]);
218
-
217
+ $ key = key ($ this ->values [$ this ->maxPriority ]);
218
+
219
219
if (false === next ($ this ->values [$ this ->maxPriority ])) {
220
220
unset($ this ->priorities [$ this ->maxPriority ]);
221
221
unset($ this ->values [$ this ->maxPriority ]);
222
222
$ this ->maxPriority = empty ($ this ->priorities ) ? null : max ($ this ->priorities );
223
223
$ this ->subIndex = -1 ;
224
224
} else {
225
- unset($ this ->values [$ this ->maxPriority ][$ key ]);
225
+ unset($ this ->values [$ this ->maxPriority ][$ key ]);
226
226
}
227
227
++$ this ->index ;
228
228
++$ this ->subIndex ;
0 commit comments