1 | <?php |
||
21 | class FencedCode extends AbstractStringContainerBlock |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $info; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | protected $length; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $char; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | protected $offset; |
||
42 | |||
43 | /** |
||
44 | * @param int $length |
||
45 | * @param string $char |
||
46 | * @param int $offset |
||
47 | */ |
||
48 | 132 | public function __construct(int $length, string $char, int $offset) |
|
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | 3 | public function getInfo(): string |
|
61 | { |
||
62 | 3 | return $this->info; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return string[] |
||
67 | */ |
||
68 | 114 | public function getInfoWords(): array |
|
69 | { |
||
70 | 114 | return \preg_split('/\s+/', $this->info) ?: []; |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | 111 | public function getChar(): string |
|
80 | |||
81 | /** |
||
82 | * @param string $char |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | 3 | public function setChar(string $char): self |
|
87 | { |
||
88 | 3 | $this->char = $char; |
|
89 | |||
90 | 3 | return $this; |
|
91 | } |
||
92 | |||
93 | /** |
||
94 | * @return int |
||
95 | */ |
||
96 | 96 | public function getLength(): int |
|
100 | |||
101 | /** |
||
102 | * @param int $length |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | 90 | public function setLength(int $length): self |
|
112 | |||
113 | /** |
||
114 | * @return int |
||
115 | */ |
||
116 | 6 | public function getOffset(): int |
|
120 | |||
121 | /** |
||
122 | * @param int $offset |
||
123 | * |
||
124 | * @return $this |
||
125 | */ |
||
126 | 3 | public function setOffset(int $offset): self |
|
132 | |||
133 | 3 | public function canContain(AbstractBlock $block): bool |
|
137 | |||
138 | 102 | public function isCode(): bool |
|
142 | |||
143 | 99 | public function matchesNextLine(Cursor $cursor): bool |
|
158 | |||
159 | 114 | public function finalize(ContextInterface $context, int $endLineNumber) |
|
177 | |||
178 | 105 | public function handleRemainingContents(ContextInterface $context, Cursor $cursor) |
|
196 | |||
197 | 105 | public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool |
|
201 | } |
||
202 |