summaryrefslogtreecommitdiff
path: root/src/Renderer/Twig/Extensions/Session.php
blob: 4690f701f63f1316ded9e6cbcc1d38d6b2fd11ef (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 Symfony\Component\HttpFoundation\Session\Session as SymfonySession;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;

class Session extends TwigExtension
{
    /** @var SymfonySession */
    protected $session;

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

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