RemoveProperties::transform()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace Ghc\Rosetta\Transformers;
4
5
class RemoveProperties extends Transformer
6
{
7
    /**
8
     * @param array $data
9
     *
10
     * @return array
11
     */
12
    public function transform($data)
13
    {
14
        return collect($data)->reject(function ($value, $key) {
15
            return in_array($key, $this->config['properties']);
16
        })->map(function ($value) {
17
            return !is_array($value) ? $value : $this->transform($value);
18
        })->toArray();
19
    }
20
}
21