1 | <?php |
||
17 | class SiteParser |
||
18 | { |
||
19 | const EVENT_PARSER_INIT = 'parser.initialised'; |
||
20 | |||
21 | const EVENT_PAGE_PARSING = 'page.parsing'; |
||
22 | |||
23 | const EVENT_PAGE_PARSED = 'page.parsed'; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $filter; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $srcDir; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | private $metaConfig; |
||
39 | |||
40 | /** |
||
41 | * @var SplFileInfo[] |
||
42 | */ |
||
43 | private $templates; |
||
44 | |||
45 | /** |
||
46 | * @var EventDispatcher |
||
47 | */ |
||
48 | private $eventDispatcher; |
||
49 | |||
50 | /** |
||
51 | * @var PageParser |
||
52 | */ |
||
53 | private $pageParser; |
||
54 | |||
55 | /** |
||
56 | * SiteParser constructor. |
||
57 | * |
||
58 | * @param string $srcDir |
||
59 | * @param EventDispatcher $eventDispatcher |
||
60 | * @param PageParser $pageParser |
||
61 | * @param array $metaConfig |
||
62 | */ |
||
63 | public function __construct( |
||
74 | |||
75 | /** |
||
76 | * Load a site from YAML configuration files in the `directories.src`/site directory. |
||
77 | * All YAML files are loaded and parsed into Page objects and added to a Site collection. |
||
78 | * |
||
79 | * @param array $routes |
||
80 | * |
||
81 | * @return Site |
||
82 | * @throws InvalidSiteException |
||
83 | * @see \Brendt\Stitcher\Site\Page |
||
84 | * @see \Brendt\Stitcher\Site\Site |
||
85 | */ |
||
86 | public function loadSite(array $routes = []) : Site { |
||
110 | |||
111 | /** |
||
112 | * Parse a path into usable data. |
||
113 | * |
||
114 | * @param array $routes |
||
115 | * @param string $filterValue |
||
116 | * |
||
117 | * @return array|mixed |
||
118 | * @throws TemplateNotFoundException |
||
119 | */ |
||
120 | public function parse($routes = [], string $filterValue = null) : array { |
||
142 | |||
143 | /** |
||
144 | * @param string $filter |
||
145 | * |
||
146 | * @return SiteParser |
||
147 | */ |
||
148 | public function setFilter(string $filter) : SiteParser { |
||
153 | |||
154 | /** |
||
155 | * @return Meta |
||
156 | */ |
||
157 | private function createMeta() : Meta { |
||
162 | } |
||
163 |