1 | <?php |
||
21 | class Page |
||
22 | { |
||
23 | /** |
||
24 | * @var \Phile\Model\Meta the meta model |
||
25 | */ |
||
26 | protected $meta; |
||
27 | |||
28 | /** |
||
29 | * @var string the content |
||
30 | */ |
||
31 | protected $content; |
||
32 | |||
33 | /** |
||
34 | * @var string the path to the original file |
||
35 | */ |
||
36 | protected $filePath; |
||
37 | |||
38 | /** |
||
39 | * @var string the raw file |
||
40 | */ |
||
41 | protected $rawData; |
||
42 | |||
43 | /** |
||
44 | * @var \Phile\ServiceLocator\ParserInterface the parser |
||
45 | */ |
||
46 | protected $parser; |
||
47 | |||
48 | /** |
||
49 | * @var string the pageId of the page |
||
50 | */ |
||
51 | protected $pageId; |
||
52 | |||
53 | /** |
||
54 | * @var \Phile\Model\Page the previous page if one exist |
||
55 | */ |
||
56 | protected $previousPage; |
||
57 | |||
58 | /** |
||
59 | * @var \Phile\Model\Page the next page if one exist |
||
60 | */ |
||
61 | protected $nextPage; |
||
62 | |||
63 | /** |
||
64 | * @var string The content folder, as passed to the class constructor when initiating the object. |
||
65 | */ |
||
66 | protected $contentFolder; |
||
67 | |||
68 | /** |
||
69 | * @var string content extension |
||
70 | */ |
||
71 | protected $contentExtension; |
||
72 | |||
73 | /** |
||
74 | * the constructor |
||
75 | * |
||
76 | * @param $filePath |
||
77 | * @param string $folder |
||
78 | */ |
||
79 | 15 | public function __construct($filePath, $folder = null) |
|
115 | |||
116 | /** |
||
117 | * method to get content of page, this method returned the parsed content |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 3 | public function getContent() |
|
141 | |||
142 | /** |
||
143 | * set content of page |
||
144 | * |
||
145 | * @param $content |
||
146 | */ |
||
147 | 3 | public function setContent($content) |
|
151 | |||
152 | /** |
||
153 | * get raw (un-parsed) page content |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | 2 | public function getRawContent() |
|
161 | |||
162 | /** |
||
163 | * get the meta model |
||
164 | * |
||
165 | * @return Meta |
||
166 | */ |
||
167 | 8 | public function getMeta() |
|
171 | |||
172 | /** |
||
173 | * parse the raw content |
||
174 | */ |
||
175 | 15 | protected function parseRawData() |
|
191 | |||
192 | /** |
||
193 | * get the title of page from meta information |
||
194 | * |
||
195 | * @return string|null |
||
196 | */ |
||
197 | 5 | public function getTitle() |
|
201 | |||
202 | /** |
||
203 | * get Phile $pageId |
||
204 | * |
||
205 | * @param string $filePath |
||
206 | * @return string |
||
207 | */ |
||
208 | 15 | protected function buildPageId($filePath) |
|
217 | |||
218 | /** |
||
219 | * get the url of page |
||
220 | * |
||
221 | * @return string |
||
222 | */ |
||
223 | 2 | public function getUrl() |
|
227 | |||
228 | /** |
||
229 | * set the filepath of the page |
||
230 | * |
||
231 | * @param string $filePath |
||
232 | */ |
||
233 | 15 | public function setFilePath($filePath) |
|
238 | |||
239 | /** |
||
240 | * get the filepath of the page |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | 3 | public function getFilePath() |
|
248 | |||
249 | /** |
||
250 | * get the folder name |
||
251 | * |
||
252 | * @return string |
||
253 | */ |
||
254 | public function getFolder() |
||
258 | |||
259 | 2 | public function getPageId() |
|
263 | |||
264 | /** |
||
265 | * get the previous page if one exist |
||
266 | * |
||
267 | * @return null|\Phile\Model\Page |
||
268 | */ |
||
269 | 1 | public function getPreviousPage() |
|
274 | |||
275 | /** |
||
276 | * get the next page if one exist |
||
277 | * |
||
278 | * @return null|\Phile\Model\Page |
||
279 | */ |
||
280 | 1 | public function getNextPage() |
|
285 | } |
||
286 |