| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class TemplateResolver |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Path to template. |
||
| 15 | */ |
||
| 16 | protected string $templatePath; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * TemplatePathMatcher instance. |
||
| 20 | */ |
||
| 21 | protected TemplatePathMatcher $templatePathMatcher; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * transforms received path to a valid realpath |
||
| 25 | */ |
||
| 26 | 3 | public function __construct(string $templatePath, TemplatePathMatcher $templatePathMatcher) |
|
| 27 | { |
||
| 28 | 3 | $this->templatePath = rtrim($templatePath, '/'); |
|
| 29 | 3 | $this->templatePathMatcher = $templatePathMatcher; |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * resolves path for specific template |
||
| 34 | */ |
||
| 35 | 3 | public function resolve(string $templateName): string |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * trys different paths to resolve a valid template path |
||
| 42 | */ |
||
| 43 | 3 | protected function getTemplatePath(string $templateName): string |
|
| 58 |