| Total Complexity | 10 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 90.91% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Text implements TextInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | private $content; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | private $encoding; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array |
||
| 24 | */ |
||
| 25 | private $context; |
||
| 26 | |||
| 27 | 36 | public function __construct(string $content, string $encoding, array $context = []) |
|
| 28 | { |
||
| 29 | 36 | $this->content = $content; |
|
| 30 | 36 | $this->encoding = $encoding; |
|
| 31 | 36 | $this->context = $context; |
|
| 32 | 36 | } |
|
| 33 | |||
| 34 | 31 | public function getContent(): string |
|
| 35 | { |
||
| 36 | 31 | return $this->content; |
|
| 37 | } |
||
| 38 | |||
| 39 | 4 | public function getEncoding(): string |
|
| 40 | { |
||
| 41 | 4 | return $this->encoding; |
|
| 42 | } |
||
| 43 | |||
| 44 | 31 | public function getContext(): array |
|
| 47 | } |
||
| 48 | |||
| 49 | 3 | public function replaceContent(string $newContent): TextInterface |
|
| 50 | { |
||
| 51 | 3 | return new self($newContent, $this->encoding, $this->context); |
|
| 52 | 1 | } |
|
| 53 | |||
| 54 | public function mergeContext(array $context, bool $override = true): TextInterface |
||
| 64 | 28 | ); |
|
| 65 | } |
||
| 66 | |||
| 67 | public static function utf8(string $text, array $context = []): self |
||
| 70 | } |
||
| 71 | |||
| 72 | public function __toString() |
||
| 75 | } |
||
| 76 | } |
||
| 77 |