Total Complexity | 7 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Text implements TextInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | private $context; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $string; |
||
18 | |||
19 | public function __construct(string $string, array $context) |
||
20 | { |
||
21 | $this->string = $string; |
||
22 | $this->context = $context; |
||
23 | } |
||
24 | |||
25 | public function setContext(array $context): self |
||
26 | { |
||
27 | 36 | $this->context = $context; |
|
28 | |||
29 | 36 | return $this; |
|
30 | 36 | } |
|
31 | 36 | ||
32 | 36 | public function getContent(): string |
|
33 | { |
||
34 | 31 | return $this->string; |
|
35 | } |
||
36 | 31 | ||
37 | public function getContext(): array |
||
40 | } |
||
41 | 4 | ||
42 | public function replaceContent(string $newContent): TextInterface |
||
43 | { |
||
44 | 31 | return new self($newContent, $this->context); |
|
45 | } |
||
46 | 31 | ||
47 | public function mergeContext(array $context, bool $override = true): TextInterface |
||
52 | 1 | ); |
|
53 | } |
||
54 | } |
||
55 |