Failed Conditions
Pull Request — release/0.2.0 (#12)
by Yo
02:12
created

PathHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 25
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A appendPathSeparator() 0 12 2
A separator() 0 4 1
1
<?php
2
namespace Yoanm\InitPhpRepository\Helper;
3
4
/**
5
 * Class PathHelper
6
 */
7
class PathHelper
8
{
9
    /**
10
     * @param string $component
11
     *
12
     * @return string
13
     */
14
    public static function appendPathSeparator($component)
15
    {
16
        if (strrpos($component, self::separator()) === (strlen($component) - 1)) {
17
            return $component;
18
        }
19
20
        return sprintf(
21
            '%s%s',
22
            $component,
23
            self::separator()
24
        );
25
    }
26
27
    public static function separator()
28
    {
29
        return '/';
30
    }
31
}
32