Test Failed
Push — master ( 766a39...696a12 )
by Dispositif
09:33
created

ArrayProcessTrait::completeFantasyOrder()   B

Complexity

Conditions 7
Paths 12

Size

Total Lines 29
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 7

Importance

Changes 0
Metric Value
cc 7
eloc 17
nc 12
nop 2
dl 0
loc 29
ccs 18
cts 18
cp 1
crap 7
rs 8.8333
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of dispositif/wikibot application
4
 * 2019 : Philippe M. <[email protected]>
5
 * For the full copyright and MIT license information, please view the LICENSE file.
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Domain\Utils;
11
12
trait ArrayProcessTrait
13
{
14
    /**
15
     * Set all array keys to lower case (do not change the values).
16
     */
17
    private static function arrayKeysToLower(array $array): array
18
    {
19
        $res = [];
20
        foreach ($array as $key => $val) {
21 22
            $res[mb_strtolower($key)] = $val;
22
        }
23 22
24 22
        return $res;
25 22
    }
26
27
    public function deleteEmptyValueArray(array $array): array
28 22
    {
29
        return array_filter($array, function ($value) {
30
            return (null !== $value && '' !== $value);
31
        });
32
    }
33
}
34