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 | 71 | public function __construct(Config $config) |
|
144 | |||
145 | /** |
||
146 | * Render scene this DOM Object is attached to |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | 5 | public function render(): string |
|
167 | |||
168 | /** |
||
169 | * Set Scene meta title |
||
170 | * |
||
171 | * @param string $title |
||
172 | */ |
||
173 | 7 | public function setTitle(string $title) |
|
177 | |||
178 | /** |
||
179 | * Set Scene meta description |
||
180 | * |
||
181 | * @param string $description |
||
182 | */ |
||
183 | 7 | public function setDescription(string $description) |
|
187 | |||
188 | /** |
||
189 | * Append entities |
||
190 | * |
||
191 | * @param array $entities |
||
192 | * @return void |
||
193 | */ |
||
194 | 7 | public function appendEntities(array $entities) |
|
202 | |||
203 | /** |
||
204 | * Append assets |
||
205 | * |
||
206 | * @param array $assets |
||
207 | * @return void |
||
208 | */ |
||
209 | 2 | public function appendAssets(array $assets) |
|
222 | |||
223 | /** |
||
224 | * Append asset |
||
225 | * |
||
226 | * Create asset DOMElement |
||
227 | * |
||
228 | * @param AssetsInterface $asset |
||
229 | */ |
||
230 | 2 | public function appendAsset(AssetsInterface $asset) |
|
235 | |||
236 | /** |
||
237 | * Create entity DOMElement |
||
238 | * |
||
239 | * Created entity and append it to scene |
||
240 | * |
||
241 | * @param Entity $entity |
||
242 | * @return void |
||
243 | */ |
||
244 | 2 | public function appendEntity(Entity $entity) |
|
249 | |||
250 | /** |
||
251 | * Get HTML of Scene only |
||
252 | * |
||
253 | * @return string |
||
254 | */ |
||
255 | 3 | public function renderSceneOnly() |
|
264 | |||
265 | /** |
||
266 | * Set configuration option related to DOM |
||
267 | * |
||
268 | * @param Config $config |
||
269 | * @return void |
||
270 | */ |
||
271 | 71 | protected function configOptions(Config $config) |
|
278 | } |
||
279 |