Completed
Push — master ( 0a581b...48954a )
by Christophe
24:56 queued 11:56
created
src/SortedCollection/AbstractSet.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -274,8 +274,7 @@
 block discarded – undo
274 274
 		try
275 275
 		{
276 276
 			return (bool) $this->map->find($element);
277
-		}
278
-		catch (\OutOfBoundsException $e)
277
+		} catch (\OutOfBoundsException $e)
279 278
 		{
280 279
 			return false;
281 280
 		}
Please login to merge, or discard this patch.
src/SortedCollection/TreeMap.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 	{
68 68
 		if ($comparator == null)
69 69
 		{
70
-			$this->comparator = function ($key1, $key2)
70
+			$this->comparator = function($key1, $key2)
71 71
 			{
72 72
 				return $key1 - $key2;
73 73
 			};
Please login to merge, or discard this patch.
Braces   +17 added lines, -34 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
 			{
72 72
 				return $key1 - $key2;
73 73
 			};
74
-		}
75
-		else
74
+		} else
76 75
 		{
77 76
 			$this->comparator = $comparator;
78 77
 		}
@@ -118,8 +117,7 @@  discard block
 block discarded – undo
118 117
 		if ($this->root)
119 118
 		{
120 119
 			return $this->root->first;
121
-		}
122
-		else
120
+		} else
123 121
 		{
124 122
 			throw new \OutOfBoundsException('First element unexisting');
125 123
 		}
@@ -139,8 +137,7 @@  discard block
 block discarded – undo
139 137
 		if ($this->root)
140 138
 		{
141 139
 			return $this->root->last;
142
-		}
143
-		else
140
+		} else
144 141
 		{
145 142
 			throw new \OutOfBoundsException('Last element unexisting');
146 143
 		}
@@ -164,8 +161,7 @@  discard block
 block discarded – undo
164 161
 		if ($predecessor)
165 162
 		{
166 163
 			return $predecessor;
167
-		}
168
-		else
164
+		} else
169 165
 		{
170 166
 			throw new \OutOfBoundsException('Predecessor element unexisting');
171 167
 		}
@@ -189,8 +185,7 @@  discard block
 block discarded – undo
189 185
 		if ($successor)
190 186
 		{
191 187
 			return $successor;
192
-		}
193
-		else
188
+		} else
194 189
 		{
195 190
 			throw new \OutOfBoundsException('Successor element unexisting');
196 191
 		}
@@ -212,8 +207,7 @@  discard block
 block discarded – undo
212 207
 		if ($this->root)
213 208
 		{
214 209
 			$lower = $this->root->find($key, $this->comparator, -2);
215
-		}
216
-		else
210
+		} else
217 211
 		{
218 212
 			$lower = null;
219 213
 		}
@@ -221,8 +215,7 @@  discard block
 block discarded – undo
221 215
 		if ($lower)
222 216
 		{
223 217
 			return $lower;
224
-		}
225
-		else
218
+		} else
226 219
 		{
227 220
 			throw new \OutOfBoundsException('Lower element unexisting');
228 221
 		}
@@ -244,8 +237,7 @@  discard block
 block discarded – undo
244 237
 		if ($this->root)
245 238
 		{
246 239
 			$floor = $this->root->find($key, $this->comparator, -1);
247
-		}
248
-		else
240
+		} else
249 241
 		{
250 242
 			$floor = null;
251 243
 		}
@@ -253,8 +245,7 @@  discard block
 block discarded – undo
253 245
 		if ($floor)
254 246
 		{
255 247
 			return $floor;
256
-		}
257
-		else
248
+		} else
258 249
 		{
259 250
 			throw new \OutOfBoundsException('Floor element unexisting');
260 251
 		}
@@ -276,8 +267,7 @@  discard block
 block discarded – undo
276 267
 		if ($this->root)
277 268
 		{
278 269
 			$find = $this->root->find($key, $this->comparator, 0);
279
-		}
280
-		else
270
+		} else
281 271
 		{
282 272
 			$find = null;
283 273
 		}
@@ -285,8 +275,7 @@  discard block
 block discarded – undo
285 275
 		if ($find)
286 276
 		{
287 277
 			return $find;
288
-		}
289
-		else
278
+		} else
290 279
 		{
291 280
 			throw new \OutOfBoundsException('Element unexisting');
292 281
 		}
@@ -308,8 +297,7 @@  discard block
 block discarded – undo
308 297
 		if ($this->root)
309 298
 		{
310 299
 			$ceiling = $this->root->find($key, $this->comparator, 1);
311
-		}
312
-		else
300
+		} else
313 301
 		{
314 302
 			$ceiling = null;
315 303
 		}
@@ -317,8 +305,7 @@  discard block
 block discarded – undo
317 305
 		if ($ceiling)
318 306
 		{
319 307
 			return $ceiling;
320
-		}
321
-		else
308
+		} else
322 309
 		{
323 310
 			throw new \OutOfBoundsException('Ceiling element unexisting');
324 311
 		}
@@ -340,8 +327,7 @@  discard block
 block discarded – undo
340 327
 		if ($this->root)
341 328
 		{
342 329
 			$higher = $this->root->find($key, $this->comparator, 2);
343
-		}
344
-		else
330
+		} else
345 331
 		{
346 332
 			$higher = null;
347 333
 		}
@@ -349,8 +335,7 @@  discard block
 block discarded – undo
349 335
 		if ($higher)
350 336
 		{
351 337
 			return $higher;
352
-		}
353
-		else
338
+		} else
354 339
 		{
355 340
 			throw new \OutOfBoundsException('Higher element unexisting');
356 341
 		}
@@ -460,8 +445,7 @@  discard block
 block discarded – undo
460 445
 		if ($this->root)
461 446
 		{
462 447
 			$this->root = $this->root->insert($key, $value, $this->comparator);
463
-		}
464
-		else
448
+		} else
465 449
 		{
466 450
 			$this->root = TreeNode::create($key, $value);
467 451
 		}
@@ -496,8 +480,7 @@  discard block
 block discarded – undo
496 480
 		if ($this->root)
497 481
 		{
498 482
 			return count($this->root);
499
-		}
500
-		else
483
+		} else
501 484
 		{
502 485
 			return 0;
503 486
 		}
Please login to merge, or discard this patch.
src/SortedCollection/TreeSet.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -131,8 +131,7 @@
 block discarded – undo
131 131
 		if ($value)
132 132
 		{
133 133
 			$map[$element] = true;
134
-		}
135
-		else
134
+		} else
136 135
 		{
137 136
 			unset($map[$element]);
138 137
 		}
Please login to merge, or discard this patch.
src/SortedCollection/AbstractMap.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -385,8 +385,7 @@  discard block
 block discarded – undo
385 385
 		try
386 386
 		{
387 387
 			return $this->find($key)->value;
388
-		}
389
-		catch (\OutOfBoundsException $e)
388
+		} catch (\OutOfBoundsException $e)
390 389
 		{
391 390
 			throw new \OutOfRangeException('Undefined offset');
392 391
 		}
@@ -406,8 +405,7 @@  discard block
 block discarded – undo
406 405
 		try
407 406
 		{
408 407
 			return (bool) $this->find($key);
409
-		}
410
-		catch (\OutOfBoundsException $e)
408
+		} catch (\OutOfBoundsException $e)
411 409
 		{
412 410
 			return false;
413 411
 		}
Please login to merge, or discard this patch.
src/SortedCollection/Iterator.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -143,8 +143,7 @@  discard block
 block discarded – undo
143 143
 		try
144 144
 		{
145 145
 			$this->current = $this->map->first();
146
-		}
147
-		catch (\OutOfBoundsException $e)
146
+		} catch (\OutOfBoundsException $e)
148 147
 		{
149 148
 			$this->current = null;
150 149
 		}
@@ -162,8 +161,7 @@  discard block
 block discarded – undo
162 161
 		if ($this->type == self::PAIRS)
163 162
 		{
164 163
 			return $this->current->key;
165
-		}
166
-		else
164
+		} else
167 165
 		{
168 166
 			return $this->index;
169 167
 		}
@@ -181,8 +179,7 @@  discard block
 block discarded – undo
181 179
 		if ($this->type == self::KEYS)
182 180
 		{
183 181
 			return $this->current->key;
184
-		}
185
-		else
182
+		} else
186 183
 		{
187 184
 			return $this->current->value;
188 185
 		}
@@ -200,8 +197,7 @@  discard block
 block discarded – undo
200 197
 		try
201 198
 		{
202 199
 			$this->current = $this->map->successor($this->current);
203
-		}
204
-		catch (\OutOfBoundsException $e)
200
+		} catch (\OutOfBoundsException $e)
205 201
 		{
206 202
 			$this->current = null;
207 203
 		}
Please login to merge, or discard this patch.
src/SortedCollection/ReversedMap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@
 block discarded – undo
67 67
 	protected function __construct(SortedMap $map)
68 68
 	{
69 69
 		$this->map = $map;
70
-		$this->comparator = function ($key1, $key2)
70
+		$this->comparator = function($key1, $key2)
71 71
 		{
72
-			return - call_user_func($this->map->comparator, $key1, $key2);
72
+			return -call_user_func($this->map->comparator, $key1, $key2);
73 73
 		};
74 74
 	}
75 75
 
Please login to merge, or discard this patch.
examples/SubSet.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections
15 15
  */
16 16
 
17
-require __DIR__ . '/../vendor/autoload.php';
17
+require __DIR__.'/../vendor/autoload.php';
18 18
 
19 19
 use chdemko\SortedCollection\TreeSet;
20 20
 use chdemko\SortedCollection\ReversedSet;
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 $sub = SubSet::create($reversed, 7, 2);
26 26
 
27 27
 // Print [7,6,5,4,3]
28
-echo $sub . PHP_EOL;
28
+echo $sub.PHP_EOL;
29 29
 
30 30
 // Print [7,6,5,3]
31 31
 unset($set[4]);
32
-echo $sub . PHP_EOL;
32
+echo $sub.PHP_EOL;
33 33
 
34 34
 // Print [9,8,7,6,5,3]
35 35
 unset($sub->from);
36
-echo $sub . PHP_EOL;
36
+echo $sub.PHP_EOL;
Please login to merge, or discard this patch.
examples/ReversedSet.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections
15 15
  */
16 16
 
17
-require __DIR__ . '/../vendor/autoload.php';
17
+require __DIR__.'/../vendor/autoload.php';
18 18
 
19 19
 use chdemko\SortedCollection\TreeSet;
20 20
 use chdemko\SortedCollection\ReversedSet;
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 $reversed = ReversedSet::create($set);
24 24
 
25 25
 // Print [9,8,7,6,5,4,3,2,1,0]
26
-echo $reversed . PHP_EOL;
26
+echo $reversed.PHP_EOL;
27 27
 
28 28
 // Print [8,7,6,5,4,3,2,1,0]
29 29
 unset($set[9]);
30
-echo $reversed . PHP_EOL;
30
+echo $reversed.PHP_EOL;
Please login to merge, or discard this patch.
examples/ReversedMap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections
15 15
  */
16 16
 
17
-require __DIR__ . '/../vendor/autoload.php';
17
+require __DIR__.'/../vendor/autoload.php';
18 18
 
19 19
 use chdemko\SortedCollection\TreeMap;
20 20
 use chdemko\SortedCollection\ReversedMap;
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 $reversed = ReversedMap::create($tree);
24 24
 
25 25
 // Print {"9":9,"8":8,"7":7,"6":6,"5":5,"4":4,"3":3,"2":2,"1":1,"0":0}
26
-echo $reversed . PHP_EOL;
26
+echo $reversed.PHP_EOL;
27 27
 
28 28
 // Print {"8":8,"7":7,"6":6,"5":5,"4":4,"3":3,"2":2,"1":1,"0":0}
29 29
 unset($tree[9]);
30
-echo $reversed . PHP_EOL;
30
+echo $reversed.PHP_EOL;
Please login to merge, or discard this patch.