Total Complexity | 13 |
Total Lines | 82 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
22 | class FencedCode extends AbstractBlock implements StringContainerInterface |
||
23 | { |
||
24 | /** @var string|null */ |
||
25 | protected $info; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $literal = ''; |
||
29 | |||
30 | /** @var int */ |
||
31 | protected $length; |
||
32 | |||
33 | /** @var string */ |
||
34 | protected $char; |
||
35 | |||
36 | /** @var int */ |
||
37 | protected $offset; |
||
38 | |||
39 | 129 | public function __construct(int $length, string $char, int $offset) |
|
40 | { |
||
41 | 129 | parent::__construct(); |
|
42 | |||
43 | 129 | $this->length = $length; |
|
44 | 129 | $this->char = $char; |
|
45 | 129 | $this->offset = $offset; |
|
46 | 129 | } |
|
47 | |||
48 | 3 | public function getInfo(): ?string |
|
49 | { |
||
50 | 3 | return $this->info; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string[] |
||
55 | */ |
||
56 | 117 | public function getInfoWords(): array |
|
57 | { |
||
58 | 117 | return \preg_split('/\s+/', $this->info ?? '') ?: []; |
|
59 | } |
||
60 | |||
61 | 114 | public function setInfo(string $info): void |
|
62 | { |
||
63 | 114 | $this->info = $info; |
|
64 | 114 | } |
|
65 | |||
66 | 114 | public function getLiteral(): string |
|
67 | { |
||
68 | 114 | return $this->literal; |
|
69 | } |
||
70 | |||
71 | 114 | public function setLiteral(string $literal): void |
|
74 | 114 | } |
|
75 | |||
76 | 108 | public function getChar(): string |
|
77 | { |
||
78 | 108 | return $this->char; |
|
79 | } |
||
80 | |||
81 | 3 | public function setChar(string $char): void |
|
82 | { |
||
83 | 3 | $this->char = $char; |
|
84 | 3 | } |
|
85 | |||
86 | 99 | public function getLength(): int |
|
87 | { |
||
88 | 99 | return $this->length; |
|
89 | } |
||
90 | |||
91 | 3 | public function setLength(int $length): void |
|
92 | { |
||
93 | 3 | $this->length = $length; |
|
94 | 3 | } |
|
95 | |||
96 | 102 | public function getOffset(): int |
|
97 | { |
||
98 | 102 | return $this->offset; |
|
99 | } |
||
100 | |||
101 | 3 | public function setOffset(int $offset): void |
|
104 | 3 | } |
|
105 | } |
||
106 |