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

PathUtils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A composePath() 0 12 1
A reducePathLeft() 0 3 1
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