Passed
Pull Request — master (#347)
by Mirko
09:07
created

ArrayUtil::trimExplode()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 8
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 13
rs 9.4285
1
<?php
2
3
namespace AppBundle\Util;
4
5
class ArrayUtil
6
{
7
    /**
8
     * @param string $delimiter
9
     * @param string $string
10
     *
11
     * @return array
12
     */
13
    public static function trimExplode($delimiter, $string)
14
    {
15
        $result = [];
16
        $temp = explode($delimiter, $string);
17
        foreach ($temp as $value) {
18
            $value = trim($value);
19
            if ($value !== '') {
20
                $result[] = $value;
21
            }
22
        }
23
24
        return $result;
25
    }
26
}
27