@@ -121,6 +121,48 @@ public function getName(): ?string
121
121
}
122
122
123
123
124
+ /** @return static */
125
+ public function setClass (): self
126
+ {
127
+ $ this ->type = self ::TYPE_CLASS ;
128
+ return $ this ;
129
+ }
130
+
131
+
132
+ public function isClass (): bool
133
+ {
134
+ return $ this ->type === self ::TYPE_CLASS ;
135
+ }
136
+
137
+
138
+ /** @return static */
139
+ public function setInterface (): self
140
+ {
141
+ $ this ->type = self ::TYPE_INTERFACE ;
142
+ return $ this ;
143
+ }
144
+
145
+
146
+ public function isInterface (): bool
147
+ {
148
+ return $ this ->type === self ::TYPE_INTERFACE ;
149
+ }
150
+
151
+
152
+ /** @return static */
153
+ public function setTrait (): self
154
+ {
155
+ $ this ->type = self ::TYPE_TRAIT ;
156
+ return $ this ;
157
+ }
158
+
159
+
160
+ public function isTrait (): bool
161
+ {
162
+ return $ this ->type === self ::TYPE_TRAIT ;
163
+ }
164
+
165
+
124
166
/** @return static */
125
167
public function setType (string $ type ): self
126
168
{
@@ -268,7 +310,7 @@ public function addTrait(string $name, array $resolutions = []): self
268
310
public function addMember ($ member ): self
269
311
{
270
312
if ($ member instanceof Method) {
271
- if ($ this ->type === self :: TYPE_INTERFACE ) {
313
+ if ($ this ->isInterface () ) {
272
314
$ member ->setBody (null );
273
315
}
274
316
$ this ->methods [$ member ->getName ()] = $ member ;
@@ -418,7 +460,7 @@ public function getMethod(string $name): Method
418
460
public function addMethod (string $ name ): Method
419
461
{
420
462
$ method = new Method ($ name );
421
- if ($ this ->type === self :: TYPE_INTERFACE ) {
463
+ if ($ this ->isInterface () ) {
422
464
$ method ->setBody (null );
423
465
} else {
424
466
$ method ->setPublic ();
0 commit comments