1 | <?php |
||
33 | final class AframeDOMDocument extends DOMImplementation |
||
34 | { |
||
35 | use AframeDOMProcessor; |
||
36 | |||
37 | /** |
||
38 | * A-Frame DOM Document type |
||
39 | * |
||
40 | * @var \DOMDocumentType |
||
41 | */ |
||
42 | protected $doctypeObj; |
||
43 | |||
44 | /** |
||
45 | * A-Frame DOM Document |
||
46 | * |
||
47 | * @var \DOMDocument |
||
48 | */ |
||
49 | protected $docObj; |
||
50 | |||
51 | /** |
||
52 | * Scene meta tile |
||
53 | * |
||
54 | * @var string $scene_title |
||
55 | */ |
||
56 | protected $scene_title = 'Untitled'; |
||
57 | |||
58 | /** |
||
59 | * Scene meta description |
||
60 | * |
||
61 | * @var string $scene_description |
||
62 | */ |
||
63 | protected $scene_description = ''; |
||
64 | |||
65 | /** |
||
66 | * <head> |
||
67 | * |
||
68 | * @var \DOMElement |
||
69 | */ |
||
70 | protected $head; |
||
71 | |||
72 | /** |
||
73 | * <body> |
||
74 | * |
||
75 | * @var \DOMElement |
||
76 | */ |
||
77 | protected $body; |
||
78 | |||
79 | /** |
||
80 | * <a-scene> |
||
81 | * |
||
82 | * @var \DOMElement |
||
83 | */ |
||
84 | protected $scene; |
||
85 | |||
86 | /** |
||
87 | * <a-assets> |
||
88 | * |
||
89 | * @var \DOMElement |
||
90 | */ |
||
91 | protected $assets; |
||
92 | |||
93 | /************ |
||
94 | * CONFIG |
||
95 | ***********/ |
||
96 | |||
97 | /** |
||
98 | * Nicely formats output with indentation and extra space. |
||
99 | * |
||
100 | * @var bool |
||
101 | */ |
||
102 | protected $format_output = false; |
||
103 | |||
104 | /** |
||
105 | * CDN Of aframe.js |
||
106 | * |
||
107 | * @var string |
||
108 | */ |
||
109 | protected $cdn_url; |
||
110 | |||
111 | /** |
||
112 | * Whether to use CDN |
||
113 | * |
||
114 | * @var bool $use_cdn |
||
115 | */ |
||
116 | protected $use_cdn = false; |
||
117 | |||
118 | /** |
||
119 | * aframe assets URI relative to App's base URL / domain |
||
120 | * |
||
121 | * @var string assets_uri |
||
122 | */ |
||
123 | protected $assets_uri; |
||
124 | |||
125 | /** |
||
126 | * A-Frame DOM |
||
127 | * |
||
128 | * @param Config $config |
||
129 | */ |
||
130 | 98 | public function __construct(Config $config) |
|
144 | |||
145 | /** |
||
146 | * Render scene this DOM Object is attached to |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | 7 | public function render(): string |
|
165 | |||
166 | /** |
||
167 | * Set Scene meta title |
||
168 | * |
||
169 | * @param string $title |
||
170 | */ |
||
171 | 7 | public function setTitle(string $title) |
|
175 | |||
176 | /** |
||
177 | * Set Scene meta description |
||
178 | * |
||
179 | * @param string $description |
||
180 | */ |
||
181 | 7 | public function setDescription(string $description) |
|
185 | |||
186 | /** |
||
187 | * Append entities |
||
188 | * |
||
189 | * @param array $entities |
||
190 | * @return void |
||
191 | */ |
||
192 | 9 | public function appendEntities(array $entities) |
|
200 | |||
201 | /** |
||
202 | * Append assets |
||
203 | * |
||
204 | * @param array $assets |
||
205 | * @return void |
||
206 | */ |
||
207 | 2 | public function appendAssets(array $assets) |
|
220 | |||
221 | /** |
||
222 | * Append asset |
||
223 | * |
||
224 | * Create asset DOMElement |
||
225 | * |
||
226 | * @param AssetsInterface $asset |
||
227 | */ |
||
228 | 2 | public function appendAsset(AssetsInterface $asset) |
|
233 | |||
234 | /** |
||
235 | * Create entity DOMElement |
||
236 | * |
||
237 | * Created entity and append it to scene |
||
238 | * |
||
239 | * @param Entity $entity |
||
240 | * @return void |
||
241 | */ |
||
242 | 5 | public function appendEntity(Entity $entity) |
|
247 | |||
248 | /** |
||
249 | * Get HTML of Scene only |
||
250 | * |
||
251 | * @return string |
||
252 | */ |
||
253 | 3 | public function renderSceneOnly() |
|
262 | |||
263 | /** |
||
264 | * Add scene components |
||
265 | * |
||
266 | * @param array $components |
||
267 | * @return void |
||
268 | */ |
||
269 | 9 | public function appendSceneComponents(array $components) |
|
280 | |||
281 | /** |
||
282 | * Set configuration option related to DOM |
||
283 | * |
||
284 | * @param Config $config |
||
285 | * @return void |
||
286 | */ |
||
287 | 98 | protected function configOptions(Config $config) |
|
294 | |||
295 | /** |
||
296 | * Set individual option |
||
297 | * |
||
298 | * @param Config $config |
||
299 | * @param string $opt |
||
300 | * @param mixed $default |
||
301 | * @return void |
||
302 | */ |
||
303 | 98 | protected function setConfigurationOption(Config $config, string $opt, $default) |
|
307 | } |
||
308 |