removeEmptyInArray()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ImportBundle\Transformer;
6
7
class RemoveEmptyInArrayTransformer extends AbstractTransformer
8
{
9 1
    public function transform($value, string $name = '', array $options = [])
10
    {
11 1
        return $this->removeEmptyInArray($value);
12
    }
13
14 1
    public function validate($value, string $name = '', array $options = []): bool
15
    {
16 1
        return true;
17
    }
18
19
    private function removeEmptyInArray($value)
20
    {
21 1
        return array_filter($value, function ($item) {
22 1
            return !empty((is_array($item)) ? $this->removeEmptyInArray($item) : $item);
23 1
        });
24
    }
25
}
26