Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | 1 | final class AssetMacroSet extends Latte\Macros\MacroSet |
|
10 | { |
||
11 | /** |
||
12 | * @param \Latte\Compiler $compiler |
||
13 | * |
||
14 | * @return void |
||
15 | */ |
||
16 | 1 | public static function install(Latte\Compiler $compiler): void |
|
17 | { |
||
18 | 1 | $me = new static($compiler); |
|
19 | |||
20 | 1 | $me->addMacro('asset', [$me, 'macroAsset']); |
|
21 | 1 | $me->addMacro('asset_version', [$me, 'macroAssetVersion']); |
|
22 | 1 | } |
|
23 | |||
24 | /** |
||
25 | * @param \Latte\MacroNode $node |
||
26 | * @param \Latte\PhpWriter $writer |
||
27 | * |
||
28 | * @return string |
||
29 | * @throws \Latte\CompileException |
||
30 | */ |
||
31 | 1 | public function macroAsset(Latte\MacroNode $node, Latte\PhpWriter $writer): string |
|
32 | { |
||
33 | 1 | return $writer->write('echo %escape(%modify($this->global->symfonyPackages->getUrl(%node.args)))'); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param \Latte\MacroNode $node |
||
38 | * @param \Latte\PhpWriter $writer |
||
39 | * |
||
40 | * @return string |
||
41 | * @throws \Latte\CompileException |
||
42 | */ |
||
43 | 1 | public function macroAssetVersion(Latte\MacroNode $node, Latte\PhpWriter $writer): string |
|
46 | } |
||
47 | } |
||
48 |