Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
StringExtension | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
getFilters | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Engelsystem\Renderer\Twig\Extensions; |
6 | |
7 | use Illuminate\Support\Str as IlluminateStr; |
8 | use Twig\Extension\AbstractExtension as TwigExtension; |
9 | use Twig\TwigFilter; |
10 | |
11 | class StringExtension extends TwigExtension |
12 | { |
13 | public function getFilters(): array |
14 | { |
15 | return [ |
16 | new TwigFilter('slug', function ($title, $separator = '-', $language = 'en') { |
17 | return IlluminateStr::slug($title, $separator, $language); |
18 | }), |
19 | ]; |
20 | } |
21 | } |