PathParser   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 50
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C parse() 0 42 8
1
<?php
2
3
namespace Scaffolder\Compilers\Support;
4
5
class PathParser
6
{
7
    /**
8
     * Parse a path.
9
     *
10
     * @param $path
11
     */
12
    public static function parse($path)
13
    {
14
        $path = explode(':', $path, 2);
15
16
        if (count($path) == 2)
17
        {
18
            if (head($path) == 'app')
19
            {
20
                $path = app_path(last($path));
21
            }
22
            elseif (head($path) == 'base')
23
            {
24
                $path = base_path(last($path));
25
            }
26
            elseif (head($path) == 'config')
27
            {
28
                $path = config_path(last($path));
29
            }
30
            elseif (head($path) == 'database')
31
            {
32
                $path = database_path(last($path));
33
            }
34
            elseif (head($path) == 'public')
35
            {
36
                $path = public_path(last($path));
37
            }
38
            elseif (head($path) == 'storage')
39
            {
40
                $path = storage_path(last($path));
41
            }
42
            else
43
            {
44
                $path = head($path);
45
            }
46
        }
47
        else
48
        {
49
            $path = head($path);
50
        }
51
52
        return $path;
53
    }
54
}