Passed
Push — master ( 8504b1...2428d5 )
by Joachim
09:20 queued 07:48
created

TwigTag::getContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\TagBag\Tag;
6
7
final class TwigTag extends Tag implements TwigTagInterface
8
{
9
    /** @var string */
10
    private $template;
11
12
    /** @var array */
13
    private $context = [];
14
15 4
    public function __construct(string $key, string $template)
16
    {
17 4
        parent::__construct($key);
18
19 4
        $this->template = $template;
20 4
    }
21
22 1
    public function getTemplate(): string
23
    {
24 1
        return $this->template;
25
    }
26
27 3
    public function getContext(): array
28
    {
29 3
        return $this->context;
30
    }
31
32 2
    public function setContext(array $context): self
33
    {
34 2
        $this->context = $context;
35
36 2
        return $this;
37
    }
38
39
    /**
40
     * @param mixed $value
41
     */
42 1
    public function addContext(string $key, $value): self
43
    {
44 1
        $this->context[$key] = $value;
45
46 1
        return $this;
47
    }
48
}
49