Passed
Pull Request — master (#1)
by Joachim
21:04
created

PhpTemplatesTag::setContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
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
    public function __construct(string $key, string $template)
16
    {
17
        parent::__construct($key);
0 ignored issues
show
Bug introduced by
The method __construct() does not exist on Setono\TagBag\Tag\Tag. It seems like you code against a sub-type of Setono\TagBag\Tag\Tag such as Setono\TagBag\Tag\ContentTag or Setono\TagBag\Tag\PhpTemplatesTag. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        parent::/** @scrutinizer ignore-call */ 
18
                __construct($key);
Loading history...
18
19
        $this->template = $template;
20
    }
21
22
    public function getTemplate(): string
23
    {
24
        return $this->template;
25
    }
26
27
    public function getContext(): array
28
    {
29
        return $this->context;
30
    }
31
32
    public function setContext(array $context): self
33
    {
34
        $this->context = $context;
35
36
        return $this;
37
    }
38
39
    /**
40
     * @param mixed $value
41
     */
42
    public function addContext(string $key, $value): self
43
    {
44
        $this->context[$key] = $value;
45
46
        return $this;
47
    }
48
}
49