Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
21 | 28 | public function generateAbsolutePath(string $relativePath): string |
|
22 | { |
||
23 | 28 | $suffix = $this->configFileNameSuffix; |
|
24 | 28 | if ($suffix === '') { |
|
25 | 24 | return ''; |
|
26 | } |
||
27 | |||
28 | // place the file suffix right before the file extension |
||
29 | 4 | $dotPos = strpos($relativePath, '.'); |
|
30 | |||
31 | 4 | if ($dotPos !== false) { |
|
32 | 3 | $relativePathWithFileSuffix = substr($relativePath, 0, $dotPos) |
|
33 | 3 | . '-' . $suffix |
|
34 | 3 | . substr($relativePath, $dotPos); |
|
35 | } else { |
||
36 | 1 | $relativePathWithFileSuffix = $relativePath . '-' . $suffix; |
|
37 | } |
||
38 | |||
39 | 4 | return sprintf( |
|
40 | 4 | '%s/%s', |
|
41 | 4 | rtrim($this->appRootDir, '/'), |
|
42 | 4 | ltrim($relativePathWithFileSuffix, '/') |
|
43 | ); |
||
46 |