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

ArrayUtil   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A trimExplode() 0 13 3
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