| @@ 59-69 (lines=11) @@ | ||
| 56 | * @throws BadShaderCallException |
|
| 57 | * @return Entity|\AframeVR\Interfaces\ComponentInterface |
|
| 58 | */ |
|
| 59 | public function __call(string $method, array $args) |
|
| 60 | { |
|
| 61 | $id = $args[0] ?? 'untitled'; |
|
| 62 | $primitive = sprintf('\AframeVR\Extras\Primitives\%s', ucfirst($method)); |
|
| 63 | ||
| 64 | if (class_exists($primitive)) { |
|
| 65 | return $this->childrens[$id] ?? $this->childrens[$id] = new $primitive($id); |
|
| 66 | } else { |
|
| 67 | throw new BadPrimitiveCallException($method); |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| 71 | public function getChildern() |
|
| 72 | { |
|
| @@ 234-244 (lines=11) @@ | ||
| 231 | * @throws BadShaderCallException |
|
| 232 | * @return Entity|\AframeVR\Interfaces\ComponentInterface |
|
| 233 | */ |
|
| 234 | public function __call(string $method, array $args) |
|
| 235 | { |
|
| 236 | $id = $args[0] ?? 'untitled'; |
|
| 237 | $primitive = sprintf('\AframeVR\Extras\Primitives\%s', ucfirst($method)); |
|
| 238 | ||
| 239 | if (class_exists($primitive)) { |
|
| 240 | return $this->childrens[$id] ?? $this->childrens[$id] = new $primitive($id); |
|
| 241 | } else { |
|
| 242 | return $this->callComponent($method, $args); |
|
| 243 | } |
|
| 244 | } |
|
| 245 | ||
| 246 | /** |
|
| 247 | * Handle entity components |
|