1 | <?php |
||
36 | trait MeshAttributes |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * material.color |
||
41 | * |
||
42 | * @param string $color |
||
43 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
|
|||
44 | */ |
||
45 | 3 | public function color(string $color = 'gray'): EntityInterface |
|
52 | |||
53 | /** |
||
54 | * material.metalness |
||
55 | * |
||
56 | * @param string $metalness |
||
57 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
58 | */ |
||
59 | 3 | public function metalness($metalness = 0): EntityInterface |
|
66 | |||
67 | /** |
||
68 | * material.roughness |
||
69 | * |
||
70 | * @param string $roughness |
||
71 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
72 | */ |
||
73 | 3 | public function roughness($roughness = 0.5): EntityInterface |
|
80 | |||
81 | /** |
||
82 | * material.src |
||
83 | * |
||
84 | * @param string $src |
||
85 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
86 | */ |
||
87 | 3 | public function src(string $src = null): EntityInterface |
|
94 | |||
95 | /** |
||
96 | * geometry.translate |
||
97 | * |
||
98 | * @param string $translate |
||
99 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
100 | */ |
||
101 | 3 | public function translate($translate = '0 0 0'): EntityInterface |
|
106 | |||
107 | /** |
||
108 | * material.shader |
||
109 | * |
||
110 | * @param string $shader |
||
111 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
112 | */ |
||
113 | 3 | public function shader($shader = 'standard'): EntityInterface |
|
118 | |||
119 | /** |
||
120 | * material.opacity |
||
121 | * |
||
122 | * @param string $opacity |
||
123 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
124 | */ |
||
125 | 3 | public function opacity(float $opacity = 1.0): EntityInterface |
|
130 | |||
131 | /** |
||
132 | * material.transparent |
||
133 | * |
||
134 | * @param string $transparent |
||
135 | * @return \AframeVR\Core\Helpers\MeshAttributes |
||
136 | */ |
||
137 | 3 | public function transparent(string $transparent = 'false'): EntityInterface |
|
142 | } |
||
143 |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.