Passed
Push — master ( 1b58c8...5bb8d0 )
by Aleksandr
02:30
created

trim_first()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 1
1
<?php
2
3
if (!function_exists('trim_first')) {
4
    /**
5
     * Trimming first element in each array.
6
     *
7
     * @param array $array
8
     *
9
     * @return array
10
     */
11
    function trim_first(array $array): array
12
    {
13
        array_walk($array, function (&$item) {
14
            list($firstElement) = $item;
15
16
            $item = trim($firstElement);
17
        });
18
19
        return $array;
20
    }
21
}
22