1 | <?php |
||
31 | final class Scene |
||
32 | { |
||
33 | /* All scenes can use primitives */ |
||
34 | use Primitives; |
||
35 | |||
36 | /** |
||
37 | * Name with what you can retrieve this scene while working with multiple scenes |
||
38 | * |
||
39 | * @var string $name |
||
40 | */ |
||
41 | private $keyword; |
||
42 | |||
43 | /** |
||
44 | * Is scene prepared for rendering |
||
45 | * |
||
46 | * @var bool |
||
47 | */ |
||
48 | private $prepared; |
||
49 | |||
50 | protected $assets; |
||
51 | |||
52 | /** |
||
53 | * Aframe Document Object Model |
||
54 | * |
||
55 | * @var \AframeVR\Core\DOM\AframeDOMDocument |
||
56 | */ |
||
57 | protected $aframeDomObj; |
||
58 | |||
59 | /** |
||
60 | * A-Frame scene entities |
||
61 | * |
||
62 | * @var array $entities |
||
63 | */ |
||
64 | protected $entities = array(); |
||
65 | |||
66 | /** |
||
67 | * Scene constructor |
||
68 | * |
||
69 | * @param string $keyword |
||
70 | * @param Config $config |
||
71 | */ |
||
72 | 71 | public function __construct(string $keyword, Config $config) |
|
79 | |||
80 | /** |
||
81 | * Aframe Document Object Model |
||
82 | * |
||
83 | * @api |
||
84 | * |
||
85 | * @return \AframeVR\Core\DOM\AframeDOMDocument |
||
86 | */ |
||
87 | 8 | public function dom() |
|
91 | |||
92 | /** |
||
93 | * Entity |
||
94 | * |
||
95 | * @api |
||
96 | * |
||
97 | * @param string $name |
||
98 | * @return \AframeVR\Core\Entity |
||
99 | */ |
||
100 | 31 | public function entity(string $name = 'untitled'): Entity |
|
104 | |||
105 | /** |
||
106 | * Assets |
||
107 | * |
||
108 | * @api |
||
109 | * |
||
110 | * @return \AframeVR\Core\Assets |
||
111 | */ |
||
112 | 71 | public function asset(): Assets |
|
116 | |||
117 | /** |
||
118 | * Render the A-Frame scene and return the HTML |
||
119 | * |
||
120 | * @api |
||
121 | * |
||
122 | * @param bool $only_scene |
||
123 | * @return string |
||
124 | */ |
||
125 | 7 | public function save($only_scene = false, string $file = null): string |
|
135 | |||
136 | /** |
||
137 | * Render the A-Frame scene and passthru HTML |
||
138 | * |
||
139 | * @api |
||
140 | * |
||
141 | * @param bool $only_scene |
||
142 | * @return void |
||
143 | */ |
||
144 | 1 | public function render($only_scene = false) |
|
148 | |||
149 | /** |
||
150 | * Alias of AframeDOMDocument::setTitle(string) |
||
151 | * |
||
152 | * Set <title> tag |
||
153 | * $this->dom()->setTitle(string); |
||
154 | * |
||
155 | * @api |
||
156 | * |
||
157 | * @param string $title |
||
158 | */ |
||
159 | 7 | public function title(string $title) |
|
163 | |||
164 | /** |
||
165 | * Alias of AframeDOMDocument::setDescription(string) |
||
166 | * |
||
167 | * Set <meta name="description"> tag |
||
168 | * $this->dom()->setDescription(string); |
||
169 | * |
||
170 | * @api |
||
171 | * |
||
172 | * @param string $description |
||
173 | */ |
||
174 | 7 | public function description(string $description) |
|
178 | |||
179 | /** |
||
180 | * Get scenes keyword |
||
181 | * |
||
182 | * @return void |
||
183 | */ |
||
184 | 1 | public function getKeyword() |
|
188 | |||
189 | /** |
||
190 | * Add everyting to DOM |
||
191 | * |
||
192 | * @return void |
||
193 | */ |
||
194 | 7 | protected function prepare() |
|
210 | } |
||
211 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.