Test Setup Failed
Pull Request — master (#4522)
by Craig
08:26 queued 03:47
created

DefaultThemeRuntime::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\DefaultTheme\Twig;
15
16
use Symfony\Component\Yaml\Yaml;
17
use Twig\Extension\RuntimeExtensionInterface;
18
use Zikula\Bundle\CoreBundle\HttpKernel\ZikulaHttpKernelInterface;
19
20
class DefaultThemeRuntime implements RuntimeExtensionInterface
21
{
22
    /**
23
     * @var ZikulaHttpKernelInterface
24
     */
25
    private $kernel;
26
27
    public function __construct(ZikulaHttpKernelInterface $kernel)
28
    {
29
        $this->kernel = $kernel;
30
    }
31
32
    public function getStyleChoices(): array
33
    {
34
        $themeBundle = $this->kernel->getBundle('ZikulaDefaultTheme');
35
        $themeVarsPath = $themeBundle->getConfigPath() . '/variables.yaml';
0 ignored issues
show
Bug introduced by
The method getConfigPath() does not exist on Symfony\Component\HttpKe...\Bundle\BundleInterface. It seems like you code against a sub-type of Symfony\Component\HttpKe...\Bundle\BundleInterface such as Zikula\ExtensionsModule\AbstractExtension. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        $themeVarsPath = $themeBundle->/** @scrutinizer ignore-call */ getConfigPath() . '/variables.yaml';
Loading history...
36
        $variableDefinitions = Yaml::parse(file_get_contents($themeVarsPath));
37
38
        return $variableDefinitions['theme_style']['options']['choices'];
39
    }
40
}
41