Completed
Push — master ( df9f00...ccd20f )
by dan
01:37
created

BaseFormatter::setDispatcher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\Formatter;
4
5
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
6
7
abstract class BaseFormatter
8
{
9
    protected $twig;
10
    protected $eventDispatcher;
11
12
    public function setTemplating(\Twig_Environment $twig)
13
    {
14
        $this->twig = $twig;
15
    }
16
17
    public function setDispatcher(EventDispatcherInterface $eventDispatcher)
18
    {
19
        $this->eventDispatcher = $eventDispatcher;
20
    }
21
22
    protected function renderTwigTemplate($data, $user, $template)
23
    {
24
        return $this->twig->render(
25
            $template,
26
            [
27
                'data' => $data,
28
                'user' => $user,
29
            ]
30
        );
31
    }
32
}