Completed
Push — feature/anchors-twig-filter ( ee6739...2beb13 )
by Vladimir
02:22
created

TwigTemplate::getTemplateName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * @copyright 2018 Vladimir Jimenez
5
 * @license   https://github.com/stakx-io/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\Templating\Twig;
9
10
use allejo\stakx\Templating\TemplateInterface;
11
use Twig\TemplateWrapper;
12
13
class TwigTemplate implements TemplateInterface
14
{
15
    private $template;
16
17 12
    public function __construct(TemplateWrapper $template)
18
    {
19 12
        $this->template = $template;
20 12
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 12
    public function getTemplateName()
26
    {
27 12
        return $this->template->getTemplateName();
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getParentTemplate()
34
    {
35
        $parent = $this->template->getParent([]);
0 ignored issues
show
Bug introduced by
The method getParent() does not seem to exist on object<Twig\TemplateWrapper>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
37
        if ($parent === false)
38
        {
39
            return false;
40
        }
41
42
        return new TwigTemplate($parent);
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 12
    public function render(array $context = [])
49
    {
50 12
        return $this->template->render($context);
51
    }
52
}
53