Completed
Push — master ( da2f6e...d3b8cb )
by Kamil
20:06
created

TwigAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A render() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Sylius\Bundle\CoreBundle\Sitemap\Renderer;
13
14
use Sylius\Bundle\CoreBundle\Sitemap\Exception\TemplateNotFoundException;
15
use Sylius\Bundle\CoreBundle\Sitemap\Model\SitemapInterface;
16
use Symfony\Component\Templating\EngineInterface;
17
18
/**
19
 * @author Arkadiusz Krakowiak <[email protected]>
20
 */
21
class TwigAdapter implements RendererAdapterInterface
22
{
23
    /**
24
     * @var EngineInterface
25
     */
26
    private $twig;
27
28
    /**
29
     * @var string
30
     */
31
    private $template;
32
33
    /**
34
     * @param EngineInterface $twig
35
     * @param string $template
36
     */
37
    public function __construct(EngineInterface $twig, $template)
38
    {
39
        $this->twig = $twig;
40
        $this->template = $template;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function render(SitemapInterface $sitemap)
47
    {
48
        return $this->twig->render($this->template, ['url_set' => $sitemap->getUrls()]);
49
    }
50
}
51