| @@ 136-148 (lines=13) @@ | ||
| 133 | * @param LambdaHelper $helper For rendering strings in the current context. |
|
| 134 | * @return void |
|
| 135 | */ |
|
| 136 | public function addJsRequirement(string $js, LambdaHelper $helper = null): void |
|
| 137 | { |
|
| 138 | $js = trim($js); |
|
| 139 | $key = md5($js); |
|
| 140 | ||
| 141 | if (!isset(self::$jsRequirements[$key])) { |
|
| 142 | if ($helper !== null) { |
|
| 143 | $js = $helper->render($js); |
|
| 144 | } |
|
| 145 | ||
| 146 | self::$jsRequirements[$key] = $js; |
|
| 147 | } |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * Get the JavaScript requirements and purge the store. |
|
| @@ 211-223 (lines=13) @@ | ||
| 208 | * @param LambdaHelper $helper For rendering strings in the current context. |
|
| 209 | * @return void |
|
| 210 | */ |
|
| 211 | public function addCssRequirement(string $css, LambdaHelper $helper = null): void |
|
| 212 | { |
|
| 213 | $css = trim($css); |
|
| 214 | $key = md5($css); |
|
| 215 | ||
| 216 | if (!isset(self::$cssRequirements[$key])) { |
|
| 217 | if ($helper !== null) { |
|
| 218 | $css = $helper->render($css); |
|
| 219 | } |
|
| 220 | ||
| 221 | self::$cssRequirements[$key] = $css; |
|
| 222 | } |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * Get the CSS requirements and purge the store. |
|