| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function __invoke(Name $name): string { |
||
| 19 | $searchedPaths = []; |
||
| 20 | foreach ($this->theme->listThemeHierarchy() as $theme) { |
||
| 21 | $path = $theme->dir() . '/' . $name->getName() . '.' . $name->getEngine()->getFileExtension(); |
||
| 22 | if (is_file($path)) { |
||
| 23 | return $path; |
||
| 24 | } |
||
| 25 | $searchedPaths[] = [$theme->name(), $path]; |
||
| 26 | } |
||
| 27 | |||
| 28 | throw new TemplateNotFound( |
||
| 29 | $name->getName(), |
||
| 30 | array_map(function(array $tup) { |
||
| 31 | return $tup[1]; |
||
| 32 | }, $searchedPaths), |
||
| 33 | sprintf('The template "%s" was not found in the following themes: %s', |
||
| 34 | $name->getName(), |
||
| 35 | implode(', ', array_map(function(array $tup) { |
||
| 36 | return implode(':', $tup); |
||
| 37 | }, $searchedPaths)) |
||
| 38 | ) |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 52 |