1 | <?php |
||
23 | class Context implements ContextInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var Environment |
||
27 | */ |
||
28 | protected $environment; |
||
29 | |||
30 | /** |
||
31 | * @var AbstractBlock |
||
32 | */ |
||
33 | protected $doc; |
||
34 | |||
35 | /** |
||
36 | * @var AbstractBlock|null |
||
37 | */ |
||
38 | protected $tip; |
||
39 | |||
40 | /** |
||
41 | * @var AbstractBlock |
||
42 | */ |
||
43 | protected $container; |
||
44 | |||
45 | /** |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $lineNumber; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $line; |
||
54 | |||
55 | /** |
||
56 | * @var UnmatchedBlockCloser |
||
57 | */ |
||
58 | protected $blockCloser; |
||
59 | |||
60 | /** |
||
61 | * @var bool |
||
62 | */ |
||
63 | protected $blocksParsed = false; |
||
64 | |||
65 | protected $encoding = 'UTF-8'; |
||
66 | |||
67 | protected $referenceParser; |
||
68 | |||
69 | 1950 | public function __construct(Document $document, Environment $environment) |
|
81 | |||
82 | /** |
||
83 | * @param string $line |
||
84 | */ |
||
85 | 1938 | public function setNextLine($line) |
|
90 | |||
91 | /** |
||
92 | * @return Document |
||
93 | */ |
||
94 | 1941 | public function getDocument() |
|
98 | |||
99 | /** |
||
100 | * @return AbstractBlock|null |
||
101 | */ |
||
102 | 1950 | public function getTip() |
|
106 | |||
107 | /** |
||
108 | * @param AbstractBlock|null $block |
||
109 | * |
||
110 | * @return $this |
||
111 | */ |
||
112 | 1950 | public function setTip(AbstractBlock $block = null) |
|
118 | |||
119 | /** |
||
120 | * @return int |
||
121 | */ |
||
122 | 1938 | public function getLineNumber() |
|
126 | |||
127 | /** |
||
128 | * @return string |
||
129 | */ |
||
130 | 1938 | public function getLine() |
|
134 | |||
135 | /** |
||
136 | * Finalize and close any unmatched blocks |
||
137 | * |
||
138 | * @return UnmatchedBlockCloser |
||
139 | */ |
||
140 | 1938 | public function getBlockCloser() |
|
144 | |||
145 | /** |
||
146 | * @return AbstractBlock |
||
147 | */ |
||
148 | 1938 | public function getContainer() |
|
152 | |||
153 | /** |
||
154 | * @param AbstractBlock $container |
||
155 | * |
||
156 | * @return $this |
||
157 | */ |
||
158 | 1938 | public function setContainer($container) |
|
164 | |||
165 | /** |
||
166 | * @param AbstractBlock $block |
||
167 | * |
||
168 | * @return AbstractBlock |
||
169 | */ |
||
170 | 1938 | public function addBlock(AbstractBlock $block) |
|
184 | |||
185 | /** |
||
186 | * @param AbstractBlock $replacement |
||
187 | */ |
||
188 | 51 | public function replaceContainerBlock(AbstractBlock $replacement) |
|
199 | |||
200 | /** |
||
201 | * @return bool |
||
202 | */ |
||
203 | 1938 | public function getBlocksParsed() |
|
207 | |||
208 | /** |
||
209 | * @param bool $bool |
||
210 | * |
||
211 | * @return $this |
||
212 | */ |
||
213 | 1938 | public function setBlocksParsed($bool) |
|
219 | |||
220 | /** |
||
221 | * @return ReferenceParser |
||
222 | */ |
||
223 | 390 | public function getReferenceParser() |
|
227 | |||
228 | /** |
||
229 | * @return string |
||
230 | */ |
||
231 | 1938 | public function getEncoding() |
|
235 | |||
236 | /** |
||
237 | * @param string $encoding |
||
238 | * |
||
239 | * @return $this |
||
240 | */ |
||
241 | 1941 | public function setEncoding($encoding) |
|
247 | } |
||
248 |