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

PhpTemplatesTag   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 41
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setContext() 0 5 1
A getContext() 0 3 1
A addContext() 0 5 1
A __construct() 0 6 1
A getTemplate() 0 3 1
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