WithoutSuffixAbsolutePathStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 13
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
use function sprintf;
8
9 108
final class WithoutSuffixAbsolutePathStrategy implements AbsolutePathStrategyInterface
10
{
11
    public function __construct(
12 108
        private readonly string $appRootDir,
13
    ) {
14 32
    }
15
16 32
    public function generateAbsolutePath(string $relativePath): string
17 32
    {
18 32
        return sprintf(
19 32
            '%s/%s',
20 32
            rtrim($this->appRootDir, '/'),
21
            ltrim($relativePath, '/'),
22
        );
23
    }
24
}
25