| @@ 237-255 (lines=19) @@ | ||
| 234 | /** |
|
| 235 | * @return string SCSS code for variables from OC_Defaults |
|
| 236 | */ |
|
| 237 | private function getInjectedVariables(): string { |
|
| 238 | if ($this->injectedVariables !== null) { |
|
| 239 | return $this->injectedVariables; |
|
| 240 | } |
|
| 241 | $variables = ''; |
|
| 242 | foreach ($this->defaults->getScssVariables() as $key => $value) { |
|
| 243 | $variables .= '$' . $key . ': ' . $value . ';'; |
|
| 244 | } |
|
| 245 | ||
| 246 | // check for valid variables / otherwise fall back to defaults |
|
| 247 | try { |
|
| 248 | $scss = new Compiler(); |
|
| 249 | $scss->compile($variables); |
|
| 250 | $this->injectedVariables = $variables; |
|
| 251 | } catch (ParserException $e) { |
|
| 252 | $this->logger->error($e, ['app' => 'core']); |
|
| 253 | } |
|
| 254 | return $variables; |
|
| 255 | } |
|
| 256 | } |
|
| 257 | ||
| @@ 346-365 (lines=20) @@ | ||
| 343 | /** |
|
| 344 | * @return string SCSS code for variables from OC_Defaults |
|
| 345 | */ |
|
| 346 | private function getInjectedVariables(): string { |
|
| 347 | if ($this->injectedVariables !== null) { |
|
| 348 | return $this->injectedVariables; |
|
| 349 | } |
|
| 350 | $variables = ''; |
|
| 351 | foreach ($this->defaults->getScssVariables() as $key => $value) { |
|
| 352 | $variables .= '$' . $key . ': ' . $value . ';'; |
|
| 353 | } |
|
| 354 | ||
| 355 | // check for valid variables / otherwise fall back to defaults |
|
| 356 | try { |
|
| 357 | $scss = new Compiler(); |
|
| 358 | $scss->compile($variables); |
|
| 359 | $this->injectedVariables = $variables; |
|
| 360 | } catch (ParserException $e) { |
|
| 361 | $this->logger->error($e, ['app' => 'core']); |
|
| 362 | } |
|
| 363 | ||
| 364 | return $variables; |
|
| 365 | } |
|
| 366 | ||
| 367 | /** |
|
| 368 | * Add the correct uri prefix to make uri valid again |
|