1 | <?php |
||
21 | class SiteParser |
||
22 | { |
||
23 | const EVENT_PARSER_INIT = 'parser.initialised'; |
||
24 | |||
25 | const EVENT_PAGE_PARSING = 'page.parsing'; |
||
26 | |||
27 | const EVENT_PAGE_PARSED = 'page.parsed'; |
||
28 | |||
29 | const TOKEN_REDIRECT = 'redirect'; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $filter; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $srcDir; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | private $metaConfig; |
||
45 | |||
46 | /** |
||
47 | * @var EventDispatcher |
||
48 | */ |
||
49 | private $eventDispatcher; |
||
50 | |||
51 | /** |
||
52 | * @var PageParser |
||
53 | */ |
||
54 | private $pageParser; |
||
55 | |||
56 | /** |
||
57 | * @var Htaccess |
||
58 | */ |
||
59 | private $htaccess; |
||
60 | |||
61 | /** |
||
62 | * @var string |
||
63 | */ |
||
64 | private $publicDir; |
||
65 | |||
66 | /** |
||
67 | * @var bool |
||
68 | */ |
||
69 | private $async; |
||
70 | |||
71 | /** |
||
72 | * SiteParser constructor. |
||
73 | * |
||
74 | * @param string $srcDir |
||
75 | * @param string $publicDir |
||
76 | * @param bool $async |
||
77 | * @param EventDispatcher $eventDispatcher |
||
78 | * @param PageParser $pageParser |
||
79 | * @param Htaccess $htaccess |
||
80 | * @param array $metaConfig |
||
81 | */ |
||
82 | public function __construct( |
||
99 | |||
100 | /** |
||
101 | * Load a site from YAML configuration files in the `directories.src`/site directory. |
||
102 | * All YAML files are loaded and parsed into Page objects and added to a Site collection. |
||
103 | * |
||
104 | * @param array $routes |
||
105 | * |
||
106 | * @return Site |
||
107 | * @throws InvalidSiteException |
||
108 | * @see \Brendt\Stitcher\Site\Page |
||
109 | * @see \Brendt\Stitcher\Site\Site |
||
110 | */ |
||
111 | public function loadSite(array $routes = []) : Site { |
||
134 | |||
135 | /** |
||
136 | * @param Site $site |
||
137 | * @param string $route |
||
138 | * @param array $config |
||
139 | */ |
||
140 | private function loadPage(Site $site, string $route, array $config) { |
||
150 | |||
151 | /** |
||
152 | * Parse a path into usable data. |
||
153 | * |
||
154 | * @param array $routes |
||
155 | * @param string $filterValue |
||
156 | * |
||
157 | * @throws TemplateNotFoundException |
||
158 | */ |
||
159 | public function parse($routes = [], string $filterValue = null) { |
||
183 | |||
184 | /** |
||
185 | * @param string $filter |
||
186 | * |
||
187 | * @return SiteParser |
||
188 | */ |
||
189 | public function setFilter(string $filter) : SiteParser { |
||
194 | |||
195 | /** |
||
196 | * @return Meta |
||
197 | */ |
||
198 | private function createMeta() : Meta { |
||
207 | } |
||
208 |