Passed
Push — master ( 72f8f4...a05bce )
by Jesús
07:47 queued 11s
created

WithoutSuffixAbsolutePathStrategy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generateAbsolutePath() 0 6 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\Config\PathNormalizer;
6
7
final class WithoutSuffixAbsolutePathStrategy implements AbsolutePathStrategyInterface
8
{
9
    private string $appRootDir;
10
11 26
    public function __construct(string $appRootDir)
12
    {
13 26
        $this->appRootDir = $appRootDir;
14 26
    }
15
16 26
    public function generateAbsolutePath(string $relativePath): string
17
    {
18 26
        return sprintf(
19 26
            '%s/%s',
20 26
            rtrim($this->appRootDir, '/'),
21 26
            ltrim($relativePath, '/')
22
        );
23
    }
24
}
25