@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | public static function mergeRecursiveCustom( |
136 | 136 | $existing_row, |
137 | 137 | $conflict_row, |
138 | - callable $merge_resolver=null, |
|
139 | - $max_depth=null |
|
140 | - ){ |
|
138 | + callable $merge_resolver = null, |
|
139 | + $max_depth = null |
|
140 | + ) { |
|
141 | 141 | static::mustBeCountable($existing_row); |
142 | 142 | static::mustBeCountable($conflict_row); |
143 | 143 | |
144 | 144 | foreach ($conflict_row as $column => $conflict_value) { |
145 | 145 | |
146 | 146 | // not existing in first array |
147 | - if (!isset($existing_row[$column])) { |
|
147 | + if ( ! isset($existing_row[$column])) { |
|
148 | 148 | $existing_row[$column] = $conflict_value; |
149 | 149 | continue; |
150 | 150 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | else { |
179 | 179 | // same resolution as array_merge_recursive |
180 | - if (!is_array($existing_value)) { |
|
180 | + if ( ! is_array($existing_value)) { |
|
181 | 181 | $existing_row[$column] = [$existing_value]; |
182 | 182 | } |
183 | 183 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public static function mergePreservingDistincts( |
203 | 203 | $existing_row, |
204 | 204 | $conflict_row |
205 | - ){ |
|
205 | + ) { |
|
206 | 206 | return self::mergeInColumnBuckets($existing_row, $conflict_row); |
207 | 207 | } |
208 | 208 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | public static function mergeInColumnBuckets( |
220 | 220 | $existing_row, |
221 | 221 | $conflict_row, |
222 | - $existing_key=null, |
|
223 | - $conflict_key=null |
|
222 | + $existing_key = null, |
|
223 | + $conflict_key = null |
|
224 | 224 | ) { |
225 | 225 | static::mustBeCountable($existing_row); |
226 | 226 | static::mustBeCountable($conflict_row); |
@@ -228,16 +228,16 @@ discard block |
||
228 | 228 | $merged_row = []; |
229 | 229 | foreach ($existing_row as $existing_column => $existing_value) { |
230 | 230 | if ($existing_value instanceof MergeBucket) { |
231 | - $merged_row[ $existing_column ] = $existing_value; |
|
231 | + $merged_row[$existing_column] = $existing_value; |
|
232 | 232 | } |
233 | 233 | else { |
234 | 234 | if (isset($existing_key)) { |
235 | - $merged_row[ $existing_column ] = MergeBucket::from([ |
|
235 | + $merged_row[$existing_column] = MergeBucket::from([ |
|
236 | 236 | $existing_key => $existing_value |
237 | 237 | ]); |
238 | 238 | } |
239 | 239 | else { |
240 | - $merged_row[ $existing_column ] = MergeBucket::from([ |
|
240 | + $merged_row[$existing_column] = MergeBucket::from([ |
|
241 | 241 | $existing_value |
242 | 242 | ]); |
243 | 243 | } |
@@ -245,26 +245,26 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | foreach ($conflict_row as $conflict_column => $conflict_value) { |
248 | - if (! isset($merged_row[ $conflict_column ])) { |
|
249 | - $merged_row[ $conflict_column ] = new MergeBucket; |
|
248 | + if ( ! isset($merged_row[$conflict_column])) { |
|
249 | + $merged_row[$conflict_column] = new MergeBucket; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if ($conflict_value instanceof MergeBucket) { |
253 | 253 | foreach ($conflict_value as $conflict_bucket_value) { |
254 | 254 | if (isset($conflict_key)) { |
255 | - $merged_row[ $conflict_column ][$conflict_key] = $conflict_bucket_value; |
|
255 | + $merged_row[$conflict_column][$conflict_key] = $conflict_bucket_value; |
|
256 | 256 | } |
257 | 257 | else { |
258 | - $merged_row[ $conflict_column ][] = $conflict_bucket_value; |
|
258 | + $merged_row[$conflict_column][] = $conflict_bucket_value; |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | 262 | else { |
263 | 263 | if (isset($conflict_key)) { |
264 | - $merged_row[ $conflict_column ][$conflict_key] = $conflict_value; |
|
264 | + $merged_row[$conflict_column][$conflict_key] = $conflict_value; |
|
265 | 265 | } |
266 | 266 | else { |
267 | - $merged_row[ $conflict_column ][] = $conflict_value; |
|
267 | + $merged_row[$conflict_column][] = $conflict_value; |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @param array|Countable $row |
279 | 279 | * @param array $options : 'excluded_columns' |
280 | 280 | */ |
281 | - public static function cleanMergeDuplicates($row, array $options=[]) |
|
281 | + public static function cleanMergeDuplicates($row, array $options = []) |
|
282 | 282 | { |
283 | 283 | static::mustBeCountable($row); |
284 | 284 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @see mergePreservingDistincts() |
312 | 312 | * @see cleanMergeDuplicates() |
313 | 313 | */ |
314 | - public static function cleanMergeBuckets($row, array $options=[]) |
|
314 | + public static function cleanMergeBuckets($row, array $options = []) |
|
315 | 315 | { |
316 | 316 | static::mustBeCountable($row); |
317 | 317 | |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | $id = serialize($value); |
355 | 355 | } |
356 | 356 | |
357 | - if (isset($ids[ $id ])) { |
|
358 | - unset($array[ $key ]); |
|
359 | - $ids[ $id ][] = $key; |
|
357 | + if (isset($ids[$id])) { |
|
358 | + unset($array[$key]); |
|
359 | + $ids[$id][] = $key; |
|
360 | 360 | continue; |
361 | 361 | } |
362 | 362 | |
363 | - $ids[ $id ] = [$key]; |
|
363 | + $ids[$id] = [$key]; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | return $array; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } |
381 | 381 | else { |
382 | 382 | throw new \InvalidArgumentException( |
383 | - "keyExists() method missing on :\n". var_export($array, true) |
|
383 | + "keyExists() method missing on :\n".var_export($array, true) |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | |
@@ -456,16 +456,16 @@ discard block |
||
456 | 456 | throw new \InvalidArgumentException( |
457 | 457 | "Different number of " |
458 | 458 | ." values and weights for weight mean calculation: \n" |
459 | - .var_export($values, true)."\n\n" |
|
459 | + .var_export($values, true)."\n\n" |
|
460 | 460 | .var_export($weights, true) |
461 | 461 | ); |
462 | 462 | } |
463 | 463 | |
464 | - if (!$values) |
|
464 | + if ( ! $values) |
|
465 | 465 | return null; |
466 | 466 | |
467 | - $weights_sum = array_sum($weights); |
|
468 | - if (!$weights_sum) |
|
467 | + $weights_sum = array_sum($weights); |
|
468 | + if ( ! $weights_sum) |
|
469 | 469 | return 0; |
470 | 470 | |
471 | 471 | $weighted_sum = 0; |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | ); |
515 | 515 | |
516 | 516 | // The true location of the throw is still available through the backtrace |
517 | - $trace_location = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
518 | - $reflectionClass = new \ReflectionClass( get_class($exception) ); |
|
517 | + $trace_location = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
518 | + $reflectionClass = new \ReflectionClass(get_class($exception)); |
|
519 | 519 | |
520 | 520 | // file |
521 | 521 | if (isset($trace_location['file'])) { |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | ); |
553 | 553 | |
554 | 554 | // The true location of the throw is still available through the backtrace |
555 | - $trace_location = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
556 | - $reflectionClass = new \ReflectionClass( get_class($exception) ); |
|
555 | + $trace_location = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
556 | + $reflectionClass = new \ReflectionClass(get_class($exception)); |
|
557 | 557 | |
558 | 558 | // file |
559 | 559 | if (isset($trace_location['file'])) { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * |
594 | 594 | * @return string The unique identifier of the group |
595 | 595 | */ |
596 | - public static function generateGroupId($row, array $groups_definitions, array $options=[]) |
|
596 | + public static function generateGroupId($row, array $groups_definitions, array $options = []) |
|
597 | 597 | { |
598 | 598 | Arrays::mustBeCountable($row); |
599 | 599 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | : ':' |
603 | 603 | ; |
604 | 604 | |
605 | - $groups_separator = ! empty($options['groups_separator']) |
|
605 | + $groups_separator = ! empty($options['groups_separator']) |
|
606 | 606 | ? $options['groups_separator'] |
607 | 607 | : '-' |
608 | 608 | ; |
@@ -616,32 +616,32 @@ discard block |
||
616 | 616 | } |
617 | 617 | |
618 | 618 | if (is_string($group_definition_value)) { |
619 | - if ( (is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
619 | + if ((is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
620 | 620 | || ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value)) |
621 | 621 | ) { |
622 | 622 | throw new UsageException( |
623 | 623 | 'Unset column for group id generation: ' |
624 | 624 | .var_export($group_definition_value, true) |
625 | - ."\n" . var_export($row, true) |
|
625 | + ."\n".var_export($row, true) |
|
626 | 626 | ); |
627 | 627 | } |
628 | 628 | |
629 | 629 | $part_name .= $group_definition_value; |
630 | - $group_result_value = $row[ $group_definition_value ]; |
|
630 | + $group_result_value = $row[$group_definition_value]; |
|
631 | 631 | } |
632 | 632 | elseif (is_int($group_definition_value)) { |
633 | - if ( (is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
633 | + if ((is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
634 | 634 | || ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value)) |
635 | 635 | ) { |
636 | 636 | throw new UsageException( |
637 | 637 | 'Unset column for group id generation: ' |
638 | 638 | .var_export($group_definition_value, true) |
639 | - ."\n" . var_export($row, true) |
|
639 | + ."\n".var_export($row, true) |
|
640 | 640 | ); |
641 | 641 | } |
642 | 642 | |
643 | - $part_name .= $group_definition_value ? : '0'; |
|
644 | - $group_result_value = $row[ $group_definition_value ]; |
|
643 | + $part_name .= $group_definition_value ?: '0'; |
|
644 | + $group_result_value = $row[$group_definition_value]; |
|
645 | 645 | } |
646 | 646 | elseif (is_callable($group_definition_value)) { |
647 | 647 | |
@@ -665,12 +665,12 @@ discard block |
||
665 | 665 | throw new UsageException( |
666 | 666 | 'Bad value provided for group id generation: ' |
667 | 667 | .var_export($group_definition_value, true) |
668 | - ."\n" . var_export($row, true) |
|
668 | + ."\n".var_export($row, true) |
|
669 | 669 | ); |
670 | 670 | } |
671 | 671 | |
672 | - if (!is_null($part_name)) |
|
673 | - $group_parts[ $part_name ] = $group_result_value; |
|
672 | + if ( ! is_null($part_name)) |
|
673 | + $group_parts[$part_name] = $group_result_value; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | // sort the groups by names (without it the same group could have multiple ids) |
@@ -682,13 +682,13 @@ discard block |
||
682 | 682 | if (is_object($group_value)) { |
683 | 683 | $group_value = get_class($group_value) |
684 | 684 | . '_' |
685 | - . hash( 'crc32b', var_export($group_value, true) ); |
|
685 | + . hash('crc32b', var_export($group_value, true)); |
|
686 | 686 | } |
687 | 687 | elseif (is_array($group_value)) { |
688 | - $group_value = 'array_' . hash( 'crc32b', var_export($group_value, true) ); |
|
688 | + $group_value = 'array_'.hash('crc32b', var_export($group_value, true)); |
|
689 | 689 | } |
690 | 690 | |
691 | - $out[] = $group_name . $key_value_separator . $group_value; |
|
691 | + $out[] = $group_name.$key_value_separator.$group_value; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | return implode($groups_separator, $out); |
@@ -65,14 +65,12 @@ discard block |
||
65 | 65 | ) |
66 | 66 | { |
67 | 67 | $array1[$key] = self::merge($array1[$key], $value); |
68 | - } |
|
69 | - else |
|
68 | + } else |
|
70 | 69 | { |
71 | 70 | $array1[$key] = $value; |
72 | 71 | } |
73 | 72 | } |
74 | - } |
|
75 | - else |
|
73 | + } else |
|
76 | 74 | { |
77 | 75 | foreach ($array2 as $value) |
78 | 76 | { |
@@ -97,14 +95,12 @@ discard block |
||
97 | 95 | ) |
98 | 96 | { |
99 | 97 | $array1[$key] = self::merge($array1[$key], $value); |
100 | - } |
|
101 | - else |
|
98 | + } else |
|
102 | 99 | { |
103 | 100 | $array1[$key] = $value; |
104 | 101 | } |
105 | 102 | } |
106 | - } |
|
107 | - else |
|
103 | + } else |
|
108 | 104 | { |
109 | 105 | foreach ($array2 as $value) |
110 | 106 | { |
@@ -174,8 +170,7 @@ discard block |
||
174 | 170 | $column, |
175 | 171 | ] |
176 | 172 | ); |
177 | - } |
|
178 | - else { |
|
173 | + } else { |
|
179 | 174 | // same resolution as array_merge_recursive |
180 | 175 | if (!is_array($existing_value)) { |
181 | 176 | $existing_row[$column] = [$existing_value]; |
@@ -229,14 +224,12 @@ discard block |
||
229 | 224 | foreach ($existing_row as $existing_column => $existing_value) { |
230 | 225 | if ($existing_value instanceof MergeBucket) { |
231 | 226 | $merged_row[ $existing_column ] = $existing_value; |
232 | - } |
|
233 | - else { |
|
227 | + } else { |
|
234 | 228 | if (isset($existing_key)) { |
235 | 229 | $merged_row[ $existing_column ] = MergeBucket::from([ |
236 | 230 | $existing_key => $existing_value |
237 | 231 | ]); |
238 | - } |
|
239 | - else { |
|
232 | + } else { |
|
240 | 233 | $merged_row[ $existing_column ] = MergeBucket::from([ |
241 | 234 | $existing_value |
242 | 235 | ]); |
@@ -253,17 +246,14 @@ discard block |
||
253 | 246 | foreach ($conflict_value as $conflict_bucket_value) { |
254 | 247 | if (isset($conflict_key)) { |
255 | 248 | $merged_row[ $conflict_column ][$conflict_key] = $conflict_bucket_value; |
256 | - } |
|
257 | - else { |
|
249 | + } else { |
|
258 | 250 | $merged_row[ $conflict_column ][] = $conflict_bucket_value; |
259 | 251 | } |
260 | 252 | } |
261 | - } |
|
262 | - else { |
|
253 | + } else { |
|
263 | 254 | if (isset($conflict_key)) { |
264 | 255 | $merged_row[ $conflict_column ][$conflict_key] = $conflict_value; |
265 | - } |
|
266 | - else { |
|
256 | + } else { |
|
267 | 257 | $merged_row[ $conflict_column ][] = $conflict_value; |
268 | 258 | } |
269 | 259 | } |
@@ -288,15 +278,18 @@ discard block |
||
288 | 278 | ; |
289 | 279 | |
290 | 280 | foreach ($row as $column => &$values) { |
291 | - if ( ! $values instanceof MergeBucket) |
|
292 | - continue; |
|
281 | + if ( ! $values instanceof MergeBucket) { |
|
282 | + continue; |
|
283 | + } |
|
293 | 284 | |
294 | - if (in_array($column, $excluded_columns)) |
|
295 | - continue; |
|
285 | + if (in_array($column, $excluded_columns)) { |
|
286 | + continue; |
|
287 | + } |
|
296 | 288 | |
297 | 289 | $values = Arrays::unique($values); |
298 | - if (count($values) == 1) |
|
299 | - $values = $values[0]; |
|
290 | + if (count($values) == 1) { |
|
291 | + $values = $values[0]; |
|
292 | + } |
|
300 | 293 | } |
301 | 294 | |
302 | 295 | return $row; |
@@ -349,8 +342,7 @@ discard block |
||
349 | 342 | foreach ($array as $key => $value) { |
350 | 343 | if (is_scalar($value)) { |
351 | 344 | $id = $value; |
352 | - } |
|
353 | - else { |
|
345 | + } else { |
|
354 | 346 | $id = serialize($value); |
355 | 347 | } |
356 | 348 | |
@@ -374,11 +366,9 @@ discard block |
||
374 | 366 | |
375 | 367 | if (is_array($array)) { |
376 | 368 | return array_key_exists($key, $array); |
377 | - } |
|
378 | - elseif ($array instanceof ChainableArray || method_exists($array, 'keyExists')) { |
|
369 | + } elseif ($array instanceof ChainableArray || method_exists($array, 'keyExists')) { |
|
379 | 370 | return $array->keyExists($key); |
380 | - } |
|
381 | - else { |
|
371 | + } else { |
|
382 | 372 | throw new \InvalidArgumentException( |
383 | 373 | "keyExists() method missing on :\n". var_export($array, true) |
384 | 374 | ); |
@@ -404,16 +394,13 @@ discard block |
||
404 | 394 | foreach ($array as $key => &$value) { // &for optimization |
405 | 395 | if (is_scalar($value)) { |
406 | 396 | $sum += $value; |
407 | - } |
|
408 | - elseif (is_null($value)) { |
|
397 | + } elseif (is_null($value)) { |
|
409 | 398 | continue; |
410 | - } |
|
411 | - elseif (is_array($value)) { |
|
399 | + } elseif (is_array($value)) { |
|
412 | 400 | throw new \InvalidArgumentException( |
413 | 401 | "Trying to sum an array with '$sum': ".var_export($value, true) |
414 | 402 | ); |
415 | - } |
|
416 | - elseif (is_object($value)) { |
|
403 | + } elseif (is_object($value)) { |
|
417 | 404 | if ( ! method_exists($value, 'toNumber')) { |
418 | 405 | throw new \InvalidArgumentEXception( |
419 | 406 | "Trying to sum a ".get_class($value)." object which cannot be casted as a number. " |
@@ -440,17 +427,21 @@ discard block |
||
440 | 427 | */ |
441 | 428 | public static function weightedMean($values, $weights) |
442 | 429 | { |
443 | - if ($values instanceof ChainableArray) |
|
444 | - $values = $values->toArray(); |
|
430 | + if ($values instanceof ChainableArray) { |
|
431 | + $values = $values->toArray(); |
|
432 | + } |
|
445 | 433 | |
446 | - if ($weights instanceof ChainableArray) |
|
447 | - $weights = $weights->toArray(); |
|
434 | + if ($weights instanceof ChainableArray) { |
|
435 | + $weights = $weights->toArray(); |
|
436 | + } |
|
448 | 437 | |
449 | - if ( ! is_array($values)) |
|
450 | - $values = [$values]; |
|
438 | + if ( ! is_array($values)) { |
|
439 | + $values = [$values]; |
|
440 | + } |
|
451 | 441 | |
452 | - if ( ! is_array($weights)) |
|
453 | - $weights = [$weights]; |
|
442 | + if ( ! is_array($weights)) { |
|
443 | + $weights = [$weights]; |
|
444 | + } |
|
454 | 445 | |
455 | 446 | if (count($values) != count($weights)) { |
456 | 447 | throw new \InvalidArgumentException( |
@@ -461,12 +452,14 @@ discard block |
||
461 | 452 | ); |
462 | 453 | } |
463 | 454 | |
464 | - if (!$values) |
|
465 | - return null; |
|
455 | + if (!$values) { |
|
456 | + return null; |
|
457 | + } |
|
466 | 458 | |
467 | 459 | $weights_sum = array_sum($weights); |
468 | - if (!$weights_sum) |
|
469 | - return 0; |
|
460 | + if (!$weights_sum) { |
|
461 | + return 0; |
|
462 | + } |
|
470 | 463 | |
471 | 464 | $weighted_sum = 0; |
472 | 465 | foreach ($values as $i => $value) { |
@@ -505,8 +498,9 @@ discard block |
||
505 | 498 | */ |
506 | 499 | public static function mustBeCountable($value) |
507 | 500 | { |
508 | - if (static::isCountable($value)) |
|
509 | - return true; |
|
501 | + if (static::isCountable($value)) { |
|
502 | + return true; |
|
503 | + } |
|
510 | 504 | |
511 | 505 | $exception = new \InvalidArgumentException( |
512 | 506 | "A value must be Countable instead of: \n" |
@@ -543,8 +537,9 @@ discard block |
||
543 | 537 | */ |
544 | 538 | public static function mustBeTraversable($value) |
545 | 539 | { |
546 | - if (static::isTraversable($value)) |
|
547 | - return true; |
|
540 | + if (static::isTraversable($value)) { |
|
541 | + return true; |
|
542 | + } |
|
548 | 543 | |
549 | 544 | $exception = new \InvalidArgumentException( |
550 | 545 | "A value must be Traversable instead of: \n" |
@@ -628,8 +623,7 @@ discard block |
||
628 | 623 | |
629 | 624 | $part_name .= $group_definition_value; |
630 | 625 | $group_result_value = $row[ $group_definition_value ]; |
631 | - } |
|
632 | - elseif (is_int($group_definition_value)) { |
|
626 | + } elseif (is_int($group_definition_value)) { |
|
633 | 627 | if ( (is_array($row) && ! array_key_exists($group_definition_value, $row)) |
634 | 628 | || ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value)) |
635 | 629 | ) { |
@@ -642,8 +636,7 @@ discard block |
||
642 | 636 | |
643 | 637 | $part_name .= $group_definition_value ? : '0'; |
644 | 638 | $group_result_value = $row[ $group_definition_value ]; |
645 | - } |
|
646 | - elseif (is_callable($group_definition_value)) { |
|
639 | + } elseif (is_callable($group_definition_value)) { |
|
647 | 640 | |
648 | 641 | if (is_string($group_definition_value)) { |
649 | 642 | $part_name .= $group_definition_value; |
@@ -652,16 +645,14 @@ discard block |
||
652 | 645 | elseif (is_object($group_definition_value) && ($group_definition_value instanceof \Closure)) { |
653 | 646 | $part_name .= 'unnamed-closure-' |
654 | 647 | . hash('crc32b', var_export($group_definition_value, true)); |
655 | - } |
|
656 | - elseif (is_array($group_definition_value)) { |
|
648 | + } elseif (is_array($group_definition_value)) { |
|
657 | 649 | $part_name .= implode('::', $group_definition_value); |
658 | 650 | } |
659 | 651 | |
660 | 652 | $group_result_value = call_user_func_array($group_definition_value, [ |
661 | 653 | $row, &$part_name |
662 | 654 | ]); |
663 | - } |
|
664 | - else { |
|
655 | + } else { |
|
665 | 656 | throw new UsageException( |
666 | 657 | 'Bad value provided for group id generation: ' |
667 | 658 | .var_export($group_definition_value, true) |
@@ -669,8 +660,9 @@ discard block |
||
669 | 660 | ); |
670 | 661 | } |
671 | 662 | |
672 | - if (!is_null($part_name)) |
|
673 | - $group_parts[ $part_name ] = $group_result_value; |
|
663 | + if (!is_null($part_name)) { |
|
664 | + $group_parts[ $part_name ] = $group_result_value; |
|
665 | + } |
|
674 | 666 | } |
675 | 667 | |
676 | 668 | // sort the groups by names (without it the same group could have multiple ids) |
@@ -683,8 +675,7 @@ discard block |
||
683 | 675 | $group_value = get_class($group_value) |
684 | 676 | . '_' |
685 | 677 | . hash( 'crc32b', var_export($group_value, true) ); |
686 | - } |
|
687 | - elseif (is_array($group_value)) { |
|
678 | + } elseif (is_array($group_value)) { |
|
688 | 679 | $group_value = 'array_' . hash( 'crc32b', var_export($group_value, true) ); |
689 | 680 | } |
690 | 681 |