1 | <?php |
||
28 | class Page |
||
29 | { |
||
30 | protected $meta; |
||
31 | protected $data; |
||
32 | protected $id; |
||
33 | protected $templatePath; |
||
34 | protected $variables = []; |
||
35 | protected $adapters; |
||
36 | protected $parsedVariables = []; |
||
37 | /** @var Header[] */ |
||
38 | private $headers = []; |
||
39 | |||
40 | public function __construct($id, array $data = [], Meta $meta = null) { |
||
60 | |||
61 | public static function copy(Page $page): Page { |
||
64 | |||
65 | /** |
||
66 | * Defines a variable as parsed. |
||
67 | * Parsed variables will be ignored by Stitcher when compiling the website. |
||
68 | * Adapters can define parsed variables to indicate Stitcher it should skip parsing that variable during compile |
||
69 | * time. |
||
70 | * |
||
71 | * @param $name |
||
72 | * |
||
73 | * @return Page |
||
74 | * |
||
75 | * @see \Brendt\Stitcher\Stitcher::parseVariables |
||
76 | * @see \Brendt\Stitcher\adapter\CollectionAdapter::transform |
||
77 | * @see \Brendt\Stitcher\adapter\PagincationAdapter::transform |
||
78 | */ |
||
79 | public function setVariableIsParsed($name) { |
||
84 | |||
85 | /** |
||
86 | * Check whether a variable is parsed or not. |
||
87 | * Parsed variables will be ignored by Stitcher during compile time. |
||
88 | * |
||
89 | * @param $name |
||
90 | * |
||
91 | * @return bool |
||
92 | * |
||
93 | * @see \Brendt\Stitcher\Stitcher::parseVariables |
||
94 | */ |
||
95 | public function isParsedVariable($name) { |
||
98 | |||
99 | public function getId() { |
||
102 | |||
103 | public function getTemplatePath() { |
||
106 | |||
107 | public function getVariables() { |
||
110 | |||
111 | public function getAdapters() { |
||
114 | |||
115 | /** |
||
116 | * Get an adapter configuration by name. |
||
117 | * |
||
118 | * @param $name |
||
119 | * |
||
120 | * @return array |
||
121 | * |
||
122 | * @see \Brendt\Stitcher\adapter\CollectionAdapter::transform |
||
123 | * @see \Brendt\Stitcher\adapter\PagincationAdapter::transform |
||
124 | * @see \Brendt\Stitcher\Application\DevController::run |
||
125 | */ |
||
126 | public function getAdapterConfig($name) { |
||
133 | |||
134 | /** |
||
135 | * Get a variable by name. |
||
136 | * |
||
137 | * @param $name |
||
138 | * |
||
139 | * @return mixed|null |
||
140 | * |
||
141 | * @see \Brendt\Stitcher\adapter\CollectionAdapter::transform |
||
142 | * @see \Brendt\Stitcher\adapter\PagincationAdapter::transform |
||
143 | */ |
||
144 | public function getVariable($name) { |
||
151 | |||
152 | /** |
||
153 | * Set the value of a variable. |
||
154 | * |
||
155 | * @param $name |
||
156 | * @param $value |
||
157 | * |
||
158 | * @return Page |
||
159 | * |
||
160 | * @see \Brendt\Stitcher\adapter\CollectionAdapter::transform |
||
161 | * @see \Brendt\Stitcher\adapter\PagincationAdapter::transform |
||
162 | * @see \Brendt\Stitcher\Stitcher::parseVariables |
||
163 | */ |
||
164 | public function setVariableValue($name, $value) { |
||
169 | |||
170 | /** |
||
171 | * Remove an adapter. |
||
172 | * |
||
173 | * @param $name |
||
174 | * |
||
175 | * @return Page |
||
176 | * |
||
177 | * @see \Brendt\Stitcher\adapter\CollectionAdapter::transform |
||
178 | * @see \Brendt\Stitcher\adapter\PagincationAdapter::transform |
||
179 | */ |
||
180 | public function removeAdapter($name) { |
||
187 | |||
188 | /** |
||
189 | * Set the ID of this page. |
||
190 | * An page's ID can be re-set after constructing when an adapter is creating other pages based on an existing page. |
||
191 | * |
||
192 | * @param string $id |
||
193 | * |
||
194 | * @return Page |
||
195 | * |
||
196 | * @see \Brendt\Stitcher\adapter\CollectionAdapter::transform |
||
197 | * @see \Brendt\Stitcher\adapter\PagincationAdapter::transform |
||
198 | */ |
||
199 | public function setId($id) { |
||
204 | |||
205 | public function addHeader(Header $header) { |
||
208 | |||
209 | /** |
||
210 | * @return Header[] |
||
211 | */ |
||
212 | public function getHeaders() : array { |
||
215 | |||
216 | public function getMeta(): Meta { |
||
219 | } |
||
220 |