Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| TwigTextLoader | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| findTemplate | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Renderer; |
| 6 | |
| 7 | use Illuminate\Support\Str; |
| 8 | use Twig\Error\LoaderError as ErrorLoader; |
| 9 | |
| 10 | class TwigTextLoader extends TwigLoader |
| 11 | { |
| 12 | /** |
| 13 | * @throws ErrorLoader |
| 14 | */ |
| 15 | public function findTemplate(string $name, bool $throw = true): ?string |
| 16 | { |
| 17 | if (!Str::endsWith($name, '.text.twig') && !Str::endsWith($name, '.text')) { |
| 18 | $name .= '.text'; |
| 19 | } |
| 20 | |
| 21 | return parent::findTemplate($name, $throw); |
| 22 | } |
| 23 | } |