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