Passed
Push — master ( 11eaad...3f8f84 )
by Allan
02:05
created

PathUtils::reducePathLeft()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerPatches\Utils;
7
8
class PathUtils
9
{
10
    public static function composePath()
11
    {
12
        $pathSegments = array_map(
13
            function ($item) {
14
                return rtrim($item, DIRECTORY_SEPARATOR);
15
            },
16
            func_get_args()
17
        );
18
19
        return implode(
20
            DIRECTORY_SEPARATOR,
21
            array_filter($pathSegments)
22
        );
23
    }
24
    
25
    public static function reducePathLeft($path, $target)
26
    {
27
        return ltrim(substr($path, strlen($target)), DIRECTORY_SEPARATOR);
28
    }
29
}
30