| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class AssetsExtension extends AbstractExtension |
||
| 13 | { |
||
| 14 | protected string $publicDir; |
||
| 15 | |||
| 16 | public function __construct(string $publicDir) |
||
| 17 | { |
||
| 18 | $this->publicDir = $publicDir; |
||
| 19 | } |
||
| 20 | |||
| 21 | public function getName(): string |
||
| 22 | { |
||
| 23 | return 'gnutix_twig_assets_extension'; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function getFunctions(): array |
||
| 27 | { |
||
| 28 | return [new TwigFunction('asset', [$this, 'getAssetPath'])]; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getAssetPath(Request $request, string $asset, bool $throwException = true): string |
||
| 49 | } |
||
| 50 | } |
||
| 51 |