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