| @@ 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 . ' !default;'; |
|
| 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 |
|
| @@ 256-274 (lines=19) @@ | ||
| 253 | /** |
|
| 254 | * @return string SCSS code for variables from OC_Defaults |
|
| 255 | */ |
|
| 256 | private function getInjectedVariables(): string { |
|
| 257 | if ($this->injectedVariables !== null) { |
|
| 258 | return $this->injectedVariables; |
|
| 259 | } |
|
| 260 | $variables = ''; |
|
| 261 | foreach ($this->defaults->getScssVariables() as $key => $value) { |
|
| 262 | $variables .= '$' . $key . ': ' . $value . ';'; |
|
| 263 | } |
|
| 264 | ||
| 265 | // check for valid variables / otherwise fall back to defaults |
|
| 266 | try { |
|
| 267 | $scss = new Compiler(); |
|
| 268 | $scss->compile($variables); |
|
| 269 | $this->injectedVariables = $variables; |
|
| 270 | } catch (ParserException $e) { |
|
| 271 | $this->logger->error($e, ['app' => 'core']); |
|
| 272 | } |
|
| 273 | return $variables; |
|
| 274 | } |
|
| 275 | } |
|
| 276 | ||