Completed
Push — master ( a6c8f9...b97be3 )
by Vladimir
03:52 queued 19s
created

TwigError   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 72
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getTemplateLine() 0 4 1
A setTemplateLine() 0 6 1
A setContent() 0 6 1
A setName() 0 6 1
A setRelativeFilePath() 0 6 1
A buildException() 0 8 1
1
<?php
2
3
namespace allejo\stakx\Templating;
4
5
class TwigError extends \Exception implements TemplateErrorInterface
6
{
7
    private $error;
8
    private $content;
9
    private $relativeFilePath;
10
    private $name;
11
12
    public function __construct(\Twig_Error $error)
13
    {
14
        $this->error = $error;
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getTemplateLine()
21
    {
22
        return $this->error->getTemplateLine();
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function setTemplateLine($lineNumber)
29
    {
30
        $this->error->setTemplateLine($lineNumber);
31
32
        return $this;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function setContent($content)
39
    {
40
        $this->content = $content;
41
42
        return $this;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function setName($name)
49
    {
50
        $this->name = $name;
51
52
        return $this;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function setRelativeFilePath($filePath)
59
    {
60
        $this->relativeFilePath = $filePath;
61
62
        return $this;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function buildException()
69
    {
70
        $this->error->setSourceContext(new \Twig_Source(
71
            $this->content,
72
            $this->name,
73
            $this->relativeFilePath
74
        ));
75
    }
76
}
77