1 | <?php |
||
18 | class SiteParser |
||
19 | { |
||
20 | const EVENT_PARSER_INIT = 'parser.initialised'; |
||
21 | |||
22 | const EVENT_PAGE_PARSING = 'page.parsing'; |
||
23 | |||
24 | const EVENT_PAGE_PARSED = 'page.parsed'; |
||
25 | |||
26 | const TOKEN_REDIRECT = 'redirect'; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $filter; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $srcDir; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | private $metaConfig; |
||
42 | |||
43 | /** |
||
44 | * @var EventDispatcher |
||
45 | */ |
||
46 | private $eventDispatcher; |
||
47 | |||
48 | /** |
||
49 | * @var PageParser |
||
50 | */ |
||
51 | private $pageParser; |
||
52 | |||
53 | /** |
||
54 | * @var Htaccess |
||
55 | */ |
||
56 | private $htaccess; |
||
57 | |||
58 | /** |
||
59 | * SiteParser constructor. |
||
60 | * |
||
61 | * @param string $srcDir |
||
62 | * @param EventDispatcher $eventDispatcher |
||
63 | * @param PageParser $pageParser |
||
64 | * @param Htaccess $htaccess |
||
65 | * @param array $metaConfig |
||
66 | */ |
||
67 | public function __construct( |
||
80 | |||
81 | /** |
||
82 | * Load a site from YAML configuration files in the `directories.src`/site directory. |
||
83 | * All YAML files are loaded and parsed into Page objects and added to a Site collection. |
||
84 | * |
||
85 | * @param array $routes |
||
86 | * |
||
87 | * @return Site |
||
88 | * @throws InvalidSiteException |
||
89 | * @see \Brendt\Stitcher\Site\Page |
||
90 | * @see \Brendt\Stitcher\Site\Site |
||
91 | */ |
||
92 | public function loadSite(array $routes = []) : Site { |
||
122 | |||
123 | /** |
||
124 | * Parse a path into usable data. |
||
125 | * |
||
126 | * @param array $routes |
||
127 | * @param string $filterValue |
||
128 | * |
||
129 | * @return array|mixed |
||
130 | * @throws TemplateNotFoundException |
||
131 | */ |
||
132 | public function parse($routes = [], string $filterValue = null) : array { |
||
154 | |||
155 | /** |
||
156 | * @param string $filter |
||
157 | * |
||
158 | * @return SiteParser |
||
159 | */ |
||
160 | public function setFilter(string $filter) : SiteParser { |
||
165 | |||
166 | /** |
||
167 | * @return Meta |
||
168 | */ |
||
169 | private function createMeta() : Meta { |
||
178 | } |
||
179 |