1 | <?php |
||
15 | abstract class ClassAwareGenerator extends Generator |
||
16 | { |
||
17 | /** |
||
18 | * @var ConstantGenerator |
||
19 | */ |
||
20 | protected $constantGenerator; |
||
21 | |||
22 | /** |
||
23 | * @var DocBlockGenerator |
||
24 | */ |
||
25 | protected $docBlockGenerator; |
||
26 | |||
27 | /** |
||
28 | * @var MethodGenerator |
||
29 | */ |
||
30 | protected $methodGenerator; |
||
31 | |||
32 | /** |
||
33 | * @var PropertyGenerator |
||
34 | */ |
||
35 | protected $propertyGenerator; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $name; |
||
41 | |||
42 | /** |
||
43 | * @var null|string |
||
44 | */ |
||
45 | protected $namespace; |
||
46 | |||
47 | /** |
||
48 | * @var null|string |
||
49 | */ |
||
50 | protected $extends; |
||
51 | |||
52 | /** |
||
53 | * @var null|DocBlock |
||
54 | */ |
||
55 | protected $docBlock; |
||
56 | |||
57 | /** |
||
58 | * @var Constant[] |
||
59 | */ |
||
60 | protected $constants = []; |
||
61 | |||
62 | /** |
||
63 | * @var Property[] |
||
64 | */ |
||
65 | protected $properties = []; |
||
66 | |||
67 | /** |
||
68 | * @var Method[] |
||
69 | */ |
||
70 | protected $methods = []; |
||
71 | |||
72 | /** |
||
73 | * @param ConstantGenerator $constantGenerator |
||
74 | * @param DocBlockGenerator $docBlockGenerator |
||
75 | * @param MethodGenerator $methodGenerator |
||
76 | * @param PropertyGenerator $propertyGenerator |
||
77 | */ |
||
78 | 23 | public function __construct( |
|
89 | |||
90 | /** |
||
91 | * @param string $name |
||
92 | * |
||
93 | * @return static |
||
94 | */ |
||
95 | 17 | public function setName(string $name): self |
|
101 | |||
102 | /** |
||
103 | * @param null|string $namespace |
||
104 | * |
||
105 | * @return static |
||
106 | */ |
||
107 | 8 | public function setNamespace(?string $namespace): self |
|
113 | |||
114 | /** |
||
115 | * @param null|string $extends |
||
116 | * |
||
117 | * @return static |
||
118 | */ |
||
119 | 8 | public function setExtends(?string $extends): self |
|
125 | |||
126 | /** |
||
127 | * @param null|DocBlock $docBlock |
||
128 | * |
||
129 | * @return static |
||
130 | */ |
||
131 | 4 | public function setDocBlock(?DocBlock $docBlock): self |
|
137 | |||
138 | /** |
||
139 | * @param Constant $constant |
||
140 | * |
||
141 | * @return static |
||
142 | */ |
||
143 | 7 | public function addConstant(Constant $constant): self |
|
149 | |||
150 | /** |
||
151 | * @param Property $property |
||
152 | * |
||
153 | * @return static |
||
154 | */ |
||
155 | 5 | public function addProperty(Property $property): self |
|
161 | |||
162 | /** |
||
163 | * @param Method $method |
||
164 | * |
||
165 | * @return static |
||
166 | */ |
||
167 | 8 | public function addMethod(Method $method): self |
|
174 | |||
175 | /** |
||
176 | * @return string |
||
177 | */ |
||
178 | 16 | public function generate(): string |
|
186 | |||
187 | /** |
||
188 | * @return string |
||
189 | */ |
||
190 | abstract protected function scope(): string; |
||
191 | |||
192 | /** |
||
193 | * @return string |
||
194 | */ |
||
195 | abstract protected function generateScope(): string; |
||
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | 16 | protected function generateHead(): string |
|
209 | |||
210 | /** |
||
211 | * @return string |
||
212 | */ |
||
213 | 16 | protected function generateNamespace(): string |
|
221 | |||
222 | /** |
||
223 | * @return string |
||
224 | */ |
||
225 | 16 | protected function generateDocBlock(): string |
|
233 | |||
234 | /** |
||
235 | * @return string |
||
236 | */ |
||
237 | 16 | protected function generateInheritance(): string |
|
245 | |||
246 | /** |
||
247 | * @return string |
||
248 | */ |
||
249 | 16 | protected function generateFoot(): string |
|
253 | |||
254 | /** |
||
255 | * @return string |
||
256 | */ |
||
257 | 16 | protected function generateConstants(): string |
|
267 | |||
268 | /** |
||
269 | * @return string |
||
270 | */ |
||
271 | 12 | protected function generateProperties(): string |
|
288 | |||
289 | /** |
||
290 | * @return string |
||
291 | */ |
||
292 | 16 | protected function generateMethods(): string |
|
309 | } |
||
310 |