summaryrefslogtreecommitdiff
path: root/src/Renderer/Twig/Extensions/Config.php
blob: da106957643990400910e2673b32a85e0b2e2a9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace Engelsystem\Renderer\Twig\Extensions;

use Engelsystem\Config\Config as EngelsystemConfig;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;

class Config extends TwigExtension
{
    /** @var EngelsystemConfig */
    protected $config;

    /**
     * @param EngelsystemConfig $config
     */
    public function __construct(EngelsystemConfig $config)
    {
        $this->config = $config;
    }

    /**
     * @return TwigFunction[]
     */
    public function getFunctions(): array
    {
        return [
            new TwigFunction('config', [$this->config, 'get']),
        ];
    }
}