@@ -134,16 +134,16 @@ discard block |
||
| 134 | 134 | public static function mergeRecursiveCustom( |
| 135 | 135 | $existing_row, |
| 136 | 136 | $conflict_row, |
| 137 | - callable $merge_resolver=null, |
|
| 138 | - $max_depth=null |
|
| 139 | - ){ |
|
| 137 | + callable $merge_resolver = null, |
|
| 138 | + $max_depth = null |
|
| 139 | + ) { |
|
| 140 | 140 | static::mustBeCountable($existing_row); |
| 141 | 141 | static::mustBeCountable($conflict_row); |
| 142 | 142 | |
| 143 | 143 | foreach ($conflict_row as $column => $conflict_value) { |
| 144 | 144 | |
| 145 | 145 | // not existing in first array |
| 146 | - if (!isset($existing_row[$column])) { |
|
| 146 | + if ( ! isset($existing_row[$column])) { |
|
| 147 | 147 | $existing_row[$column] = $conflict_value; |
| 148 | 148 | continue; |
| 149 | 149 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | else { |
| 178 | 178 | // same resolution as array_merge_recursive |
| 179 | - if (!is_array($existing_value)) { |
|
| 179 | + if ( ! is_array($existing_value)) { |
|
| 180 | 180 | $existing_row[$column] = [$existing_value]; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | public static function mergePreservingDistincts( |
| 200 | 200 | $existing_row, |
| 201 | 201 | $conflict_row |
| 202 | - ){ |
|
| 202 | + ) { |
|
| 203 | 203 | static::mustBeCountable($existing_row); |
| 204 | 204 | static::mustBeCountable($conflict_row); |
| 205 | 205 | |
| 206 | 206 | $merge = static::mergeRecursiveCustom( |
| 207 | 207 | $existing_row, |
| 208 | 208 | $conflict_row, |
| 209 | - function ($existing_value, $conflict_value, $column) { |
|
| 209 | + function($existing_value, $conflict_value, $column) { |
|
| 210 | 210 | |
| 211 | 211 | if ( ! $existing_value instanceof MergeBucket) { |
| 212 | 212 | $existing_value = MergeBucket::from()->push($existing_value); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @param array|Countable $row |
| 236 | 236 | * @param array $options : 'excluded_columns' |
| 237 | 237 | */ |
| 238 | - public static function cleanMergeDuplicates($row, array $options=[]) |
|
| 238 | + public static function cleanMergeDuplicates($row, array $options = []) |
|
| 239 | 239 | { |
| 240 | 240 | static::mustBeCountable($row); |
| 241 | 241 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @see mergePreservingDistincts() |
| 269 | 269 | * @see cleanMergeDuplicates() |
| 270 | 270 | */ |
| 271 | - public static function cleanMergeBuckets($row, array $options=[]) |
|
| 271 | + public static function cleanMergeBuckets($row, array $options = []) |
|
| 272 | 272 | { |
| 273 | 273 | static::mustBeCountable($row); |
| 274 | 274 | |
@@ -309,13 +309,13 @@ discard block |
||
| 309 | 309 | $id = serialize($value); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if (isset($ids[ $id ])) { |
|
| 313 | - unset($array[ $key ]); |
|
| 314 | - $ids[ $id ][] = $key; |
|
| 312 | + if (isset($ids[$id])) { |
|
| 313 | + unset($array[$key]); |
|
| 314 | + $ids[$id][] = $key; |
|
| 315 | 315 | continue; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $ids[ $id ] = [$key]; |
|
| 318 | + $ids[$id] = [$key]; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | return $array; |
@@ -390,16 +390,16 @@ discard block |
||
| 390 | 390 | throw new \InvalidArgumentException( |
| 391 | 391 | "Different number of " |
| 392 | 392 | ." values and weights for weight mean calculation: \n" |
| 393 | - .var_export($values, true)."\n\n" |
|
| 393 | + .var_export($values, true)."\n\n" |
|
| 394 | 394 | .var_export($weights, true) |
| 395 | 395 | ); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if (!$values) |
|
| 398 | + if ( ! $values) |
|
| 399 | 399 | return null; |
| 400 | 400 | |
| 401 | - $weights_sum = array_sum($weights); |
|
| 402 | - if (!$weights_sum) |
|
| 401 | + $weights_sum = array_sum($weights); |
|
| 402 | + if ( ! $weights_sum) |
|
| 403 | 403 | return 0; |
| 404 | 404 | |
| 405 | 405 | $weighted_sum = 0; |
@@ -434,15 +434,15 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | public static function mustBeCountable($value) |
| 436 | 436 | { |
| 437 | - if ( ! static::isCountable($value) ) { |
|
| 437 | + if ( ! static::isCountable($value)) { |
|
| 438 | 438 | $exception = new \InvalidArgumentException( |
| 439 | 439 | "A value must be Countable instead of: \n" |
| 440 | 440 | .var_export($value, true) |
| 441 | 441 | ); |
| 442 | 442 | |
| 443 | 443 | // The true location of the throw is still available through the backtrace |
| 444 | - $trace_location = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
| 445 | - $reflectionClass = new \ReflectionClass( get_class($exception) ); |
|
| 444 | + $trace_location = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
| 445 | + $reflectionClass = new \ReflectionClass(get_class($exception)); |
|
| 446 | 446 | |
| 447 | 447 | //file |
| 448 | 448 | if (isset($trace_location['file'])) { |