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 string The content folder, as passed to the class constructor when initiating the object. |
||
55 | */ |
||
56 | protected $contentFolder; |
||
57 | |||
58 | /** |
||
59 | * @var string content extension |
||
60 | */ |
||
61 | protected $contentExtension; |
||
62 | |||
63 | /** @var Repository */ |
||
64 | protected $repository; |
||
65 | |||
66 | /** |
||
67 | * the constructor |
||
68 | * |
||
69 | * @param $filePath |
||
70 | * @param string $folder |
||
71 | */ |
||
72 | 17 | public function __construct($filePath, $folder = null) |
|
108 | |||
109 | /** |
||
110 | * method to get content of page, this method returned the parsed content |
||
111 | * |
||
112 | * @return mixed |
||
113 | */ |
||
114 | 3 | public function getContent() |
|
134 | |||
135 | /** |
||
136 | * set content of page |
||
137 | * |
||
138 | * @param $content |
||
139 | */ |
||
140 | 3 | public function setContent($content) |
|
144 | |||
145 | /** |
||
146 | * get raw (un-parsed) page content |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | 2 | public function getRawContent() |
|
154 | |||
155 | /** |
||
156 | * get the meta model |
||
157 | * |
||
158 | * @return Meta |
||
159 | */ |
||
160 | 8 | public function getMeta() |
|
164 | |||
165 | /** |
||
166 | * parse the raw content |
||
167 | */ |
||
168 | 17 | protected function parseRawData() |
|
184 | |||
185 | /** |
||
186 | * Sets repository this page was retrieved by/belongs to |
||
187 | * |
||
188 | * @param Repository $repository |
||
189 | * @return $this |
||
190 | */ |
||
191 | 17 | public function setRepository(Repository $repository) |
|
196 | |||
197 | /** |
||
198 | * Gets repository this page belongs to |
||
199 | * |
||
200 | * @return Repository |
||
201 | */ |
||
202 | 5 | public function getRepository() |
|
209 | |||
210 | /** |
||
211 | * get the title of page from meta information |
||
212 | * |
||
213 | * @return string|null |
||
214 | */ |
||
215 | 5 | public function getTitle() |
|
219 | |||
220 | /** |
||
221 | * get Phile $pageId |
||
222 | * |
||
223 | * @param string $filePath |
||
224 | * @return string |
||
225 | */ |
||
226 | 17 | protected function buildPageId($filePath) |
|
235 | |||
236 | /** |
||
237 | * get the url of page |
||
238 | * |
||
239 | * @return string |
||
240 | */ |
||
241 | 2 | public function getUrl() |
|
245 | |||
246 | /** |
||
247 | * set the filepath of the page |
||
248 | * |
||
249 | * @param string $filePath |
||
250 | */ |
||
251 | 17 | public function setFilePath($filePath) |
|
256 | |||
257 | /** |
||
258 | * get the filepath of the page |
||
259 | * |
||
260 | * @return string |
||
261 | */ |
||
262 | 3 | public function getFilePath() |
|
266 | |||
267 | /** |
||
268 | * get the folder name |
||
269 | * |
||
270 | * @return string |
||
271 | */ |
||
272 | public function getFolder() |
||
276 | |||
277 | 2 | public function getPageId() |
|
281 | |||
282 | /** |
||
283 | * get the previous page if one exist |
||
284 | * |
||
285 | * @return null|\Phile\Model\Page |
||
286 | */ |
||
287 | 1 | public function getPreviousPage() |
|
291 | |||
292 | /** |
||
293 | * get the next page if one exist |
||
294 | * |
||
295 | * @return null|\Phile\Model\Page |
||
296 | */ |
||
297 | 1 | public function getNextPage() |
|
301 | } |
||
302 |