Completed
Push — master ( 877236...2dc251 )
by ARCANEDEV
05:46
created

Arr   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A dot() 0 18 4
1
<?php namespace Arcanesoft\Settings\Helpers;
2
3
use Illuminate\Support\Arr as IlluminateArr;
4
5
/**
6
 * Class     Arr
7
 *
8
 * @package  Arcanesoft\Settings\Helpers
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class Arr extends IlluminateArr
12
{
13
    /**
14
     * Flatten a multi-dimensional associative array with dots.
15
     *
16
     * @param  array   $array
17
     * @param  string  $prepend
18
     *
19
     * @return array
20
     */
21 24
    public static function dot($array, $prepend = '')
22
    {
23 24
        $results = [];
24
25 24
        foreach ($array as $key => $value) {
26 24
            if (is_array($value)) {
27 8
                if (self::isAssoc($value)) {
28 4
                    $results = array_merge($results, self::dot($value, $prepend.$key.'.'));
29
30 4
                    continue;
31
                }
32 3
            }
33
34 24
            $results[$prepend.$key] = $value;
35 18
        }
36
37 24
        return $results;
38
    }
39
}
40