Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TwigTextLoader
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 findTemplate
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Renderer;
6
7use Illuminate\Support\Str;
8use Twig\Error\LoaderError as ErrorLoader;
9
10class 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}