Failed Conditions
Push — master ( 28e23e...6697e2 )
by Yo
01:52
created

PathHelper::appendPathSeparator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
crap 6
1
<?php
2
namespace Yoanm\DefaultPhpRepository\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