Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
Arrays
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 clean
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 join
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 flatten
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 merge
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 removeEmpty
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 rekey
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Projom\Util;
6
7use Projom\Util\Strings;
8
9class Arrays
10{
11    public static function clean(array $list): array
12    {
13        return array_map([Strings::class, 'clean'], $list);
14    }
15
16    public static function join(array $list, string $delimeter = ','): string
17    {
18        return implode($delimeter, $list);
19    }
20
21    public static function flatten(array $list): array
22    {
23        return array_merge(...$list);
24    }
25
26    public static function merge(array ...$lists): array
27    {
28        return array_merge(...$lists);
29    }
30
31    public static function removeEmpty(array $list): array
32    {
33        return array_filter($list);
34    }
35
36    public static function rekey(array $records, string $field): array
37    {
38        return array_column($records, null, $field);
39    }
40}