1 | <?php |
||
16 | abstract class ClassAwareGenerator extends Generator |
||
17 | { |
||
18 | /** |
||
19 | * @var ConstantGenerator |
||
20 | */ |
||
21 | protected $constantGenerator; |
||
22 | |||
23 | /** |
||
24 | * @var DocBlockGenerator |
||
25 | */ |
||
26 | protected $docBlockGenerator; |
||
27 | |||
28 | /** |
||
29 | * @var ImportGenerator |
||
30 | */ |
||
31 | protected $importGenerator; |
||
32 | |||
33 | /** |
||
34 | * @var MethodGenerator |
||
35 | */ |
||
36 | protected $methodGenerator; |
||
37 | |||
38 | /** |
||
39 | * @var PropertyGenerator |
||
40 | */ |
||
41 | protected $propertyGenerator; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $name; |
||
47 | |||
48 | /** |
||
49 | * @var null|string |
||
50 | */ |
||
51 | protected $namespace; |
||
52 | |||
53 | /** |
||
54 | * @var null|string |
||
55 | */ |
||
56 | protected $extends; |
||
57 | |||
58 | /** |
||
59 | * @var null|DocBlock |
||
60 | */ |
||
61 | protected $docBlock; |
||
62 | |||
63 | /** |
||
64 | * @var Constant[] |
||
65 | */ |
||
66 | protected $constants = []; |
||
67 | |||
68 | /** |
||
69 | * @var Property[] |
||
70 | */ |
||
71 | protected $properties = []; |
||
72 | |||
73 | /** |
||
74 | * @var Method[] |
||
75 | */ |
||
76 | protected $methods = []; |
||
77 | |||
78 | /** |
||
79 | * @var Import[] |
||
80 | */ |
||
81 | protected $imports = []; |
||
82 | |||
83 | /** |
||
84 | * @param ConstantGenerator $constantGenerator |
||
85 | * @param DocBlockGenerator $docBlockGenerator |
||
86 | * @param ImportGenerator $importGenerator |
||
87 | * @param MethodGenerator $methodGenerator |
||
88 | * @param PropertyGenerator $propertyGenerator |
||
89 | */ |
||
90 | 25 | public function __construct( |
|
103 | |||
104 | /** |
||
105 | * @param string $name |
||
106 | * |
||
107 | * @return static |
||
108 | */ |
||
109 | 18 | public function setName(string $name): self |
|
115 | |||
116 | /** |
||
117 | * @param null|string $namespace |
||
118 | * |
||
119 | * @return static |
||
120 | */ |
||
121 | 9 | public function setNamespace(?string $namespace): self |
|
127 | |||
128 | /** |
||
129 | * @param null|string $extends |
||
130 | * |
||
131 | * @return static |
||
132 | */ |
||
133 | 9 | public function setExtends(?string $extends): self |
|
139 | |||
140 | /** |
||
141 | * @param null|DocBlock $docBlock |
||
142 | * |
||
143 | * @return static |
||
144 | */ |
||
145 | 4 | public function setDocBlock(?DocBlock $docBlock): self |
|
151 | |||
152 | /** |
||
153 | * @param Constant $constant |
||
154 | * |
||
155 | * @return static |
||
156 | */ |
||
157 | 6 | public function addConstant(Constant $constant): self |
|
163 | |||
164 | /** |
||
165 | * @param Property $property |
||
166 | * |
||
167 | * @return static |
||
168 | */ |
||
169 | 5 | public function addProperty(Property $property): self |
|
175 | |||
176 | /** |
||
177 | * @param Method $method |
||
178 | * |
||
179 | * @return static |
||
180 | */ |
||
181 | 9 | public function addMethod(Method $method): self |
|
188 | |||
189 | 2 | public function addImport(Import $import): self |
|
195 | |||
196 | /** |
||
197 | * @return string |
||
198 | */ |
||
199 | 17 | public function generate(): string |
|
207 | |||
208 | /** |
||
209 | * @return string |
||
210 | */ |
||
211 | abstract protected function scope(): string; |
||
212 | |||
213 | /** |
||
214 | * @return string |
||
215 | */ |
||
216 | abstract protected function generateScope(): string; |
||
217 | |||
218 | /** |
||
219 | * @return string |
||
220 | */ |
||
221 | 17 | protected function generateHead(): string |
|
231 | |||
232 | /** |
||
233 | * @return string |
||
234 | */ |
||
235 | 17 | protected function generateNamespace(): string |
|
243 | |||
244 | /** |
||
245 | * @return string |
||
246 | */ |
||
247 | 17 | protected function generateImport(): string |
|
263 | |||
264 | /** |
||
265 | * @return string |
||
266 | */ |
||
267 | 17 | protected function generateDocBlock(): string |
|
275 | |||
276 | /** |
||
277 | * @return string |
||
278 | */ |
||
279 | 17 | protected function generateInheritance(): string |
|
287 | |||
288 | /** |
||
289 | * @return string |
||
290 | */ |
||
291 | 17 | protected function generateFoot(): string |
|
295 | |||
296 | /** |
||
297 | * @return string |
||
298 | */ |
||
299 | 17 | protected function generateConstants(): string |
|
309 | |||
310 | /** |
||
311 | * @return string |
||
312 | */ |
||
313 | 13 | protected function generateProperties(): string |
|
330 | |||
331 | /** |
||
332 | * @return string |
||
333 | */ |
||
334 | 17 | protected function generateMethods(): string |
|
351 | } |
||
352 |