Passed
Push — master ( 28f242...472b4c )
by Gabriel
04:44
created

Helper::normalizePath()   A

Complexity

Conditions 5
Paths 8

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 5.0342

Importance

Changes 0
Metric Value
cc 5
eloc 8
nc 8
nop 1
dl 0
loc 15
ccs 8
cts 9
cp 0.8889
crap 5.0342
rs 9.6111
c 0
b 0
f 0
1
<?php
2
3
namespace ByTIC\Migrations\Utility;
4
5
/**
6
 * Class Helper
7
 * @package ByTIC\Migrations\Utility
8
 */
9
class Helper
10
{
11
    use Traits\HasBasePathTrait;
12
    use Traits\HasCommandPathTrait;
13
14
    /**
15
     * @param mixed ...$parts
16
     * @return string
17
     */
18 9
    public static function normalizePath(...$parts)
19
    {
20 9
        $path = '';
21
22 9
        if (is_array($parts[0]) && count($parts[0]) > 1) {
23
            $parts = $parts[0];
24
        }
25 9
        if (is_string($parts[0])) {
26 9
            $path = $parts[0];
27
        }
28 9
        if (count($parts) > 1) {
29 9
            $path = implode(DIRECTORY_SEPARATOR, $parts);
30
        }
31
32 9
        return $path;
33
    }
34
}
35