Passed
Push — master ( e5a117...444e05 )
by Paweł
09:40
created

ArrayHelper::arrayMap()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 8
rs 10
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 11.01.2018
6
 */
7
8
namespace app\components;
9
10
11
use yii\helpers\BaseArrayHelper;
12
13
class ArrayHelper extends BaseArrayHelper
14
{
15
    public static function arrayMap($data, array $map): array
16
    {
17
        $res = [];
18
        foreach ($map as $to => $from) {
19
            $res[$to] = static::getValue($data, $from);
20
        }
21
22
        return $res;
23
    }
24
}