@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | $id = serialize($value); |
56 | 56 | } |
57 | 57 | |
58 | - if (isset($ids[ $id ])) { |
|
59 | - unset($array[ $key ]); |
|
60 | - $ids[ $id ][] = $key; |
|
58 | + if (isset($ids[$id])) { |
|
59 | + unset($array[$key]); |
|
60 | + $ids[$id][] = $key; |
|
61 | 61 | continue; |
62 | 62 | } |
63 | 63 | |
64 | - $ids[ $id ] = [$key]; |
|
64 | + $ids[$id] = [$key]; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $array; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | else { |
83 | 83 | throw new \InvalidArgumentException( |
84 | - "keyExists() method missing on :\n". var_export($array, true) |
|
84 | + "keyExists() method missing on :\n".var_export($array, true) |
|
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | throw new \InvalidArgumentException( |
158 | 158 | "Different number of " |
159 | 159 | ." values and weights for weight mean calculation: \n" |
160 | - .var_export($values, true)."\n\n" |
|
160 | + .var_export($values, true)."\n\n" |
|
161 | 161 | .var_export($weights, true) |
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if (!$values) |
|
165 | + if ( ! $values) |
|
166 | 166 | return null; |
167 | 167 | |
168 | - $weights_sum = array_sum($weights); |
|
169 | - if (!$weights_sum) |
|
168 | + $weights_sum = array_sum($weights); |
|
169 | + if ( ! $weights_sum) |
|
170 | 170 | return 0; |
171 | 171 | |
172 | 172 | $weighted_sum = 0; |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | ); |
216 | 216 | |
217 | 217 | // The true location of the throw is still available through the backtrace |
218 | - $trace_location = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
219 | - $reflectionClass = new \ReflectionClass( get_class($exception) ); |
|
218 | + $trace_location = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
219 | + $reflectionClass = new \ReflectionClass(get_class($exception)); |
|
220 | 220 | |
221 | 221 | // file |
222 | 222 | if (isset($trace_location['file'])) { |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | ); |
254 | 254 | |
255 | 255 | // The true location of the throw is still available through the backtrace |
256 | - $trace_location = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
257 | - $reflectionClass = new \ReflectionClass( get_class($exception) ); |
|
256 | + $trace_location = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
|
257 | + $reflectionClass = new \ReflectionClass(get_class($exception)); |
|
258 | 258 | |
259 | 259 | // file |
260 | 260 | if (isset($trace_location['file'])) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return string The unique identifier of the group |
296 | 296 | */ |
297 | - public static function generateGroupId($row, array $groups_definitions, array $options=[]) |
|
297 | + public static function generateGroupId($row, array $groups_definitions, array $options = []) |
|
298 | 298 | { |
299 | 299 | Arrays::mustBeCountable($row); |
300 | 300 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | : ':' |
304 | 304 | ; |
305 | 305 | |
306 | - $groups_separator = ! empty($options['groups_separator']) |
|
306 | + $groups_separator = ! empty($options['groups_separator']) |
|
307 | 307 | ? $options['groups_separator'] |
308 | 308 | : '-' |
309 | 309 | ; |
@@ -317,32 +317,32 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | if (is_string($group_definition_value)) { |
320 | - if ( (is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
320 | + if ((is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
321 | 321 | || ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value)) |
322 | 322 | ) { |
323 | 323 | throw new UsageException( |
324 | 324 | 'Unset column for group id generation: ' |
325 | 325 | .var_export($group_definition_value, true) |
326 | - ."\n" . var_export($row, true) |
|
326 | + ."\n".var_export($row, true) |
|
327 | 327 | ); |
328 | 328 | } |
329 | 329 | |
330 | 330 | $part_name .= $group_definition_value; |
331 | - $group_result_value = $row[ $group_definition_value ]; |
|
331 | + $group_result_value = $row[$group_definition_value]; |
|
332 | 332 | } |
333 | 333 | elseif (is_int($group_definition_value)) { |
334 | - if ( (is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
334 | + if ((is_array($row) && ! array_key_exists($group_definition_value, $row)) |
|
335 | 335 | || ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value)) |
336 | 336 | ) { |
337 | 337 | throw new UsageException( |
338 | 338 | 'Unset column for group id generation: ' |
339 | 339 | .var_export($group_definition_value, true) |
340 | - ."\n" . var_export($row, true) |
|
340 | + ."\n".var_export($row, true) |
|
341 | 341 | ); |
342 | 342 | } |
343 | 343 | |
344 | - $part_name .= $group_definition_value ? : '0'; |
|
345 | - $group_result_value = $row[ $group_definition_value ]; |
|
344 | + $part_name .= $group_definition_value ?: '0'; |
|
345 | + $group_result_value = $row[$group_definition_value]; |
|
346 | 346 | } |
347 | 347 | elseif (is_callable($group_definition_value)) { |
348 | 348 | |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | throw new UsageException( |
367 | 367 | 'Bad value provided for group id generation: ' |
368 | 368 | .var_export($group_definition_value, true) |
369 | - ."\n" . var_export($row, true) |
|
369 | + ."\n".var_export($row, true) |
|
370 | 370 | ); |
371 | 371 | } |
372 | 372 | |
373 | - if (!is_null($part_name)) |
|
374 | - $group_parts[ $part_name ] = $group_result_value; |
|
373 | + if ( ! is_null($part_name)) |
|
374 | + $group_parts[$part_name] = $group_result_value; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | // sort the groups by names (without it the same group could have multiple ids) |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | if (is_object($group_value)) { |
384 | 384 | $group_value = get_class($group_value) |
385 | 385 | . '_' |
386 | - . hash( 'crc32b', var_export($group_value, true) ); |
|
386 | + . hash('crc32b', var_export($group_value, true)); |
|
387 | 387 | } |
388 | 388 | elseif (is_array($group_value)) { |
389 | - $group_value = 'array_' . hash( 'crc32b', var_export($group_value, true) ); |
|
389 | + $group_value = 'array_'.hash('crc32b', var_export($group_value, true)); |
|
390 | 390 | } |
391 | 391 | |
392 | - $out[] = $group_name . $key_value_separator . $group_value; |
|
392 | + $out[] = $group_name.$key_value_separator.$group_value; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | return implode($groups_separator, $out); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $location_parts = [$location_parts]; |
428 | 428 | } |
429 | 429 | |
430 | - if (! is_array($location_parts)) { |
|
430 | + if ( ! is_array($location_parts)) { |
|
431 | 431 | throw new \InvalidArgumentException( |
432 | 432 | "\$location_parts must be a scalar or an array of scalars (as entries of array/ArrayAccess)" |
433 | 433 | ." instead of ".var_export($location_parts, true) |