@@ -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'); |
@@ -84,8 +84,9 @@ |
||
84 | 84 | { |
85 | 85 | $defaults = get_class_vars(get_class($this)); |
86 | 86 | foreach (get_object_vars($this) as $name => $value) { |
87 | - if (empty($value) || (array_key_exists($name, $defaults) && $value === $defaults[$name])) |
|
88 | - unset($this->$name); |
|
87 | + if (empty($value) || (array_key_exists($name, $defaults) && $value === $defaults[$name])) { |
|
88 | + unset($this->$name); |
|
89 | + } |
|
89 | 90 | } |
90 | 91 | } |
91 | 92 |
@@ -65,8 +65,9 @@ |
||
65 | 65 | { |
66 | 66 | $defaults = get_class_vars(get_class($this)); |
67 | 67 | foreach (get_object_vars($this) as $name => $value) { |
68 | - if (empty($value) || (array_key_exists($name, $defaults) && $value === $defaults[$name])) |
|
69 | - unset($this->$name); |
|
68 | + if (empty($value) || (array_key_exists($name, $defaults) && $value === $defaults[$name])) { |
|
69 | + unset($this->$name); |
|
70 | + } |
|
70 | 71 | } |
71 | 72 | } |
72 | 73 | } |
@@ -129,8 +129,9 @@ |
||
129 | 129 | * Check does component has any attributes to add to DOM element. |
130 | 130 | * default attributes most of cases are ommited so we might not have any attributes to add |
131 | 131 | */ |
132 | - if ($component->hasDOMAttributes()) |
|
133 | - $a_entity->setAttributeNode($component->getDOMAttributes()); |
|
132 | + if ($component->hasDOMAttributes()) { |
|
133 | + $a_entity->setAttributeNode($component->getDOMAttributes()); |
|
134 | + } |
|
134 | 135 | } |
135 | 136 | return $a_entity; |
136 | 137 | } |
@@ -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)); |
@@ -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'); |