Total Complexity | 5 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class ThemeExtension extends \Twig_Extension |
||
8 | { |
||
9 | /** |
||
10 | * A list of theme URLs (the active one is the last one) |
||
11 | * |
||
12 | * @var string[] |
||
13 | */ |
||
14 | private $themeUrls = []; |
||
15 | |||
16 | public function pushThemeUrl(?string $themeUrl): void |
||
17 | { |
||
18 | $this->themeUrls[] = rtrim($themeUrl, '/').'/'; |
||
19 | } |
||
20 | |||
21 | public function popThemeUrl(): ?string |
||
24 | } |
||
25 | |||
26 | private function getThemeUrl(): ?string |
||
27 | { |
||
28 | return $this->themeUrls[count($this->themeUrls)-1]; |
||
29 | } |
||
30 | |||
31 | |||
32 | /** |
||
33 | * Returns a list of functions to add to the existing list. |
||
34 | * |
||
35 | * @return \Twig_Function[] |
||
36 | */ |
||
37 | public function getFunctions() |
||
41 | ]; |
||
42 | } |
||
43 | |||
44 | public function getResourceUrl(string $resource): string |
||
47 | } |
||
48 | } |
||
49 |