@@ -554,7 +554,7 @@ |
||
554 | 554 | /** |
555 | 555 | * Is called method allowed for current primitive |
556 | 556 | * |
557 | - * @param unknown $method |
|
557 | + * @param string $method |
|
558 | 558 | */ |
559 | 559 | protected function isPrimitiveMethod($method) |
560 | 560 | { |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function getDOMAttributes(): DOMAttr |
337 | 337 | { |
338 | - $format = implode(': %s; ', array_keys(get_object_vars($this))) . ': %s;'; |
|
338 | + $format = implode(': %s; ', array_keys(get_object_vars($this))).': %s;'; |
|
339 | 339 | return new \DOMAttr('geometry', vsprintf($format, array_values(get_object_vars($this)))); |
340 | 340 | } |
341 | 341 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $method |
545 | 545 | ), $args); |
546 | 546 | } else { |
547 | - throw new InvalidComponentMethodException($method, 'Geometry::primitive ' . $this->primitive); |
|
547 | + throw new InvalidComponentMethodException($method, 'Geometry::primitive '.$this->primitive); |
|
548 | 548 | } |
549 | 549 | } catch (InvalidComponentMethodException $e) { |
550 | 550 | die($e->getMessage()); |
@@ -323,8 +323,9 @@ discard block |
||
323 | 323 | foreach (get_object_vars($this) as $name => $value) { |
324 | 324 | if (empty($value) |
325 | 325 | || (array_key_exists($name, self::P_COMMON_PROPS) && $value === self::P_COMMON_PROPS[$name]) |
326 | - || (array_key_exists($name, $defaults) && $value === $defaults[$name])) |
|
327 | - unset($this->$name); |
|
326 | + || (array_key_exists($name, $defaults) && $value === $defaults[$name])) { |
|
327 | + unset($this->$name); |
|
328 | + } |
|
328 | 329 | } |
329 | 330 | } |
330 | 331 | |
@@ -355,15 +356,17 @@ discard block |
||
355 | 356 | $this->primitive = $primitive; |
356 | 357 | $defaults = $this->primitiveDefaults(); |
357 | 358 | foreach (get_class_vars(get_class($this)) as $name => $default) { |
358 | - if ($name === 'primitive') |
|
359 | - continue; |
|
359 | + if ($name === 'primitive') { |
|
360 | + continue; |
|
361 | + } |
|
360 | 362 | |
361 | - if (array_key_exists($name, $defaults)) |
|
362 | - $this->$name = $defaults[$name]; |
|
363 | - elseif (array_key_exists($name, self::P_COMMON_PROPS)) |
|
364 | - $this->$name = self::P_COMMON_PROPS[$name]; |
|
365 | - else |
|
366 | - unset($this->$name); |
|
363 | + if (array_key_exists($name, $defaults)) { |
|
364 | + $this->$name = $defaults[$name]; |
|
365 | + } elseif (array_key_exists($name, self::P_COMMON_PROPS)) { |
|
366 | + $this->$name = self::P_COMMON_PROPS[$name]; |
|
367 | + } else { |
|
368 | + unset($this->$name); |
|
369 | + } |
|
367 | 370 | } |
368 | 371 | } else { |
369 | 372 | throw new InvalidComponentArgumentException($primitive, 'Geometry::primitive'); |
@@ -120,7 +120,7 @@ |
||
120 | 120 | /** |
121 | 121 | * Get DOMAttr for the entity |
122 | 122 | * |
123 | - * @return DOMAttr |
|
123 | + * @return \DOMAttr |
|
124 | 124 | */ |
125 | 125 | public function getDOMAttributes(): \DOMAttr |
126 | 126 | { |
@@ -171,4 +171,4 @@ |
||
171 | 171 | return $this->shaderObj; |
172 | 172 | } |
173 | 173 | } |
174 | - |
|
175 | 174 | \ No newline at end of file |
175 | + |
|
176 | 176 | \ No newline at end of file |
@@ -134,12 +134,12 @@ |
||
134 | 134 | if (empty($val) || ! property_exists($key, $this)) |
135 | 135 | unset($material[$key]); |
136 | 136 | } |
137 | - if (! empty($material)) { |
|
138 | - $material_format = implode(': %s; ', array_keys($material)) . ': %s;'; |
|
137 | + if ( ! empty($material)) { |
|
138 | + $material_format = implode(': %s; ', array_keys($material)).': %s;'; |
|
139 | 139 | $attributes[] = vsprintf($material_format, array_values($material)); |
140 | 140 | } |
141 | 141 | |
142 | - $shader_format = implode(': %s; ', array_keys(get_object_vars($this->shaderObj))) . ': %s;'; |
|
142 | + $shader_format = implode(': %s; ', array_keys(get_object_vars($this->shaderObj))).': %s;'; |
|
143 | 143 | $attributes[] = vsprintf($shader_format, array_values(get_object_vars($this->shaderObj))); |
144 | 144 | |
145 | 145 | $format = count($attributes) === 1 ? '%s' : '%s %s'; |
@@ -109,8 +109,9 @@ discard block |
||
109 | 109 | 'side' => 'front' |
110 | 110 | ); |
111 | 111 | foreach (get_object_vars($this) as $name => $value) { |
112 | - if (empty($value) || (array_key_exists($name, $defaults) && $value === $defaults[$name])) |
|
113 | - unset($this->$name); |
|
112 | + if (empty($value) || (array_key_exists($name, $defaults) && $value === $defaults[$name])) { |
|
113 | + unset($this->$name); |
|
114 | + } |
|
114 | 115 | } |
115 | 116 | |
116 | 117 | /* Remove defaults from current shader */ |
@@ -131,8 +132,9 @@ discard block |
||
131 | 132 | 'side' => $this->side ?? null |
132 | 133 | ); |
133 | 134 | foreach ($material as $key => $val) { |
134 | - if (empty($val) || ! property_exists($key, $this)) |
|
135 | - unset($material[$key]); |
|
135 | + if (empty($val) || ! property_exists($key, $this)) { |
|
136 | + unset($material[$key]); |
|
137 | + } |
|
136 | 138 | } |
137 | 139 | if (! empty($material)) { |
138 | 140 | $material_format = implode(': %s; ', array_keys($material)) . ': %s;'; |
@@ -155,8 +157,9 @@ discard block |
||
155 | 157 | */ |
156 | 158 | public function shader($shader = 'standard') |
157 | 159 | { |
158 | - if ($this->shaderObj instanceof ShaderInterface) |
|
159 | - return $this->shaderObj; |
|
160 | + if ($this->shaderObj instanceof ShaderInterface) { |
|
161 | + return $this->shaderObj; |
|
162 | + } |
|
160 | 163 | |
161 | 164 | try { |
162 | 165 | $shader = sprintf('\AframeVR\Core\Shaders\%s', ucfirst($shader)); |
@@ -61,7 +61,6 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * Set initial coordinates |
63 | 63 | * |
64 | - * @param string $coordinates |
|
65 | 64 | */ |
66 | 65 | public function __construct($x = 0, $y = 0, $z = 0) |
67 | 66 | { |
@@ -109,7 +108,7 @@ discard block |
||
109 | 108 | /** |
110 | 109 | * Get DOMAttr for the entity |
111 | 110 | * |
112 | - * @return DOMAttr |
|
111 | + * @return \DOMAttr |
|
113 | 112 | */ |
114 | 113 | public function getDOMAttributes(): \DOMAttr |
115 | 114 | { |
@@ -119,7 +118,6 @@ discard block |
||
119 | 118 | /** |
120 | 119 | * Update coordinates |
121 | 120 | * |
122 | - * @param string $coordinates |
|
123 | 121 | */ |
124 | 122 | public function update($x = 0, $y = 0, $z = 0) |
125 | 123 | { |
@@ -62,7 +62,6 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Set initial coordinates |
64 | 64 | * |
65 | - * @param string $coordinates |
|
66 | 65 | */ |
67 | 66 | public function __construct($x = 0, $y = 0, $z = 0) |
68 | 67 | { |
@@ -110,7 +109,7 @@ discard block |
||
110 | 109 | /** |
111 | 110 | * Get DOMAttr for the entity |
112 | 111 | * |
113 | - * @return DOMAttr |
|
112 | + * @return \DOMAttr |
|
114 | 113 | */ |
115 | 114 | public function getDOMAttributes(): \DOMAttr |
116 | 115 | { |
@@ -120,7 +119,6 @@ discard block |
||
120 | 119 | /** |
121 | 120 | * Update coordinates |
122 | 121 | * |
123 | - * @param string $coordinates |
|
124 | 122 | */ |
125 | 123 | public function update($x = 0, $y = 0, $z = 0) |
126 | 124 | { |
@@ -129,4 +129,4 @@ |
||
129 | 129 | $this->z = $z ?? 0; |
130 | 130 | } |
131 | 131 | } |
132 | - |
|
133 | 132 | \ No newline at end of file |
133 | + |
|
134 | 134 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * material.metalness |
53 | 53 | * |
54 | - * @param string $metalness |
|
54 | + * @param integer $metalness |
|
55 | 55 | * @return \AframeVR\Core\Helpers\MeshAttributes |
56 | 56 | */ |
57 | 57 | public function metalness($metalness = 0) |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * material.roughness |
67 | 67 | * |
68 | - * @param string $roughness |
|
68 | + * @param double $roughness |
|
69 | 69 | * @return \AframeVR\Core\Helpers\MeshAttributes |
70 | 70 | */ |
71 | 71 | public function roughness($roughness = 0.5) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * material.opacity |
121 | 121 | * |
122 | - * @param string $opacity |
|
122 | + * @param integer $opacity |
|
123 | 123 | * @return \AframeVR\Core\Helpers\MeshAttributes |
124 | 124 | */ |
125 | 125 | public function opacity($opacity = 0) |
@@ -33,6 +33,9 @@ |
||
33 | 33 | |
34 | 34 | private $name; |
35 | 35 | |
36 | + /** |
|
37 | + * @param string $name |
|
38 | + */ |
|
36 | 39 | public function __construct($name) |
37 | 40 | { |
38 | 41 | $this->name = $name; |
@@ -84,4 +84,4 @@ |
||
84 | 84 | print $aframe_dom->saveHTML(); |
85 | 85 | } |
86 | 86 | } |
87 | - |
|
88 | 87 | \ No newline at end of file |
88 | + |
|
89 | 89 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Require autoloader */ |
3 | -require dirname(__FILE__,4).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
3 | +require dirname(__FILE__, 4).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
4 | 4 | |
5 | 5 | /* Initialize A-FRAME */ |
6 | 6 | $aframe = new AframeVR\Aframe(); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | DIRECTORY_SEPARATOR |
14 | 14 | ), $class); |
15 | 15 | |
16 | - $class_file = AFRAME_ROOT . $library . '.php'; |
|
16 | + $class_file = AFRAME_ROOT.$library.'.php'; |
|
17 | 17 | if (file_exists($class_file)) |
18 | 18 | require_once ($class_file); |
19 | 19 | } |
@@ -14,7 +14,8 @@ |
||
14 | 14 | ), $class); |
15 | 15 | |
16 | 16 | $class_file = AFRAME_ROOT . $library . '.php'; |
17 | - if (file_exists($class_file)) |
|
18 | - require_once ($class_file); |
|
19 | -} |
|
17 | + if (file_exists($class_file)) { |
|
18 | + require_once ($class_file); |
|
19 | + } |
|
20 | + } |
|
20 | 21 | spl_autoload_register('aframe_autoloder'); |
@@ -59,4 +59,4 @@ |
||
59 | 59 | return $this->scenes[$name] ?? $this->scenes[$name] = new Scene($name); |
60 | 60 | } |
61 | 61 | } |
62 | - |
|
63 | 62 | \ No newline at end of file |
63 | + |
|
64 | 64 | \ No newline at end of file |