Passed
Push — master ( 6aed0c...b25483 )
by Joachim
03:39
created

PhpTemplatesTag::setContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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