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

WithoutSuffixAbsolutePathStrategy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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