This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Yoghi\Bundle\MaddaBundle\Generator; |
||
4 | |||
5 | /* |
||
6 | * This file is part of the MADDA project. |
||
7 | * |
||
8 | * (c) Stefano Tamagnini <> |
||
9 | * |
||
10 | * This source file is subject to the GPLv3 license that is bundled |
||
11 | * with this source code in the file LICENSE. |
||
12 | */ |
||
13 | |||
14 | use League\Flysystem\Adapter\Local; |
||
15 | use Psr\Log\LoggerInterface; |
||
16 | use Yoghi\Bundle\MaddaBundle\Model\Reader; |
||
17 | |||
18 | /** |
||
19 | * @author Stefano Tamagnini <> |
||
20 | */ |
||
21 | class DDDGenerator |
||
22 | { |
||
23 | /** |
||
24 | * [$logger description]. |
||
25 | * |
||
26 | * @var \Psr\Log\LoggerInterface |
||
27 | */ |
||
28 | private $logger; |
||
29 | |||
30 | /** |
||
31 | * Reader model file. |
||
32 | * |
||
33 | * @var \Yoghi\Bundle\MaddaBundle\Model\Reader |
||
34 | */ |
||
35 | private $rym; |
||
36 | |||
37 | /** |
||
38 | * Model classes: class -> namespace. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | private $modelClass; |
||
43 | |||
44 | /** |
||
45 | * Comments of model classes. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | private $modelComments; |
||
50 | |||
51 | /** |
||
52 | * Fields of model classes. |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | private $fieldsClass; |
||
57 | |||
58 | /** |
||
59 | * Array process errors. |
||
60 | * |
||
61 | * @var array |
||
62 | */ |
||
63 | private $errors; |
||
64 | |||
65 | public function __construct() |
||
66 | { |
||
67 | $this->rym = new Reader(); |
||
68 | $this->errors = []; |
||
69 | $this->modelClass = []; |
||
70 | } |
||
71 | |||
72 | public function setLogger(LoggerInterface $logger) |
||
73 | { |
||
74 | $this->logger = $logger; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * [analyze description]. |
||
79 | * |
||
80 | * @param [type] $fullPathFile [description] |
||
0 ignored issues
–
show
|
|||
81 | * |
||
82 | * @return [type] [description] |
||
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
83 | */ |
||
84 | public function analyze($fullPathFile) |
||
85 | { |
||
86 | $this->rym->readYaml($fullPathFile); |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * @param string $message |
||
91 | */ |
||
92 | private function info($message, $context = []) |
||
93 | { |
||
94 | if (!is_null($this->logger)) { |
||
95 | $this->logger->info($message, $context); |
||
96 | } |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @param string $message |
||
101 | */ |
||
102 | private function error($message, $context = []) |
||
103 | { |
||
104 | if (!is_null($this->logger)) { |
||
105 | $this->logger->error($message, $context); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * errori durante la generazione. |
||
111 | * |
||
112 | * @return array of string |
||
113 | */ |
||
114 | public function getErrors() |
||
115 | { |
||
116 | return $this->errors; |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * [generate description]. |
||
121 | * |
||
122 | * @param Local $directoryOutput directory where write generated class |
||
123 | */ |
||
124 | public function generate(Local $directoryOutput) |
||
125 | { |
||
126 | //$is_constructor_enable = true; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
127 | //$ddd_is_root_aggregate = false; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
128 | |||
129 | $specListClasses = $this->rym->getClassesDefinition(); |
||
130 | foreach ($specListClasses as $className => $properties) { |
||
0 ignored issues
–
show
The expression
$specListClasses of type array|false is not guaranteed to be traversable. How about adding an additional type check?
There are different options of fixing this problem.
![]() |
|||
131 | $this->info('Generate class', ['class' => $className]); //, 'properties' => $properties |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
132 | if (!array_key_exists('ddd', $properties)) { |
||
133 | $this->error('missing ddd section into yml for class', ['class' => $className]); |
||
134 | $this->errors[] = 'missing ddd section into yml for class '.$className; |
||
135 | $this->info('force '.$className.' to type class'); |
||
136 | $properties['ddd'] = []; |
||
137 | $properties['ddd']['type'] = 'class'; |
||
138 | } |
||
139 | |||
140 | $namespace = ''; |
||
141 | if (array_key_exists('namespace', $properties)) { |
||
142 | $namespace = $properties['namespace']; |
||
143 | } |
||
144 | |||
145 | $classComments = 'No comment found on ddd model'; |
||
146 | if (array_key_exists('description', $properties)) { |
||
147 | $classComments = $properties['description']; |
||
148 | $this->info('Found description :'.$classComments); |
||
149 | } |
||
150 | |||
151 | //FIXME: switch with $dddType as key |
||
0 ignored issues
–
show
|
|||
152 | |||
153 | $generated = false; |
||
154 | $dddType = $properties['ddd']['type']; |
||
155 | View Code Duplication | if (in_array($dddType, ['interface'])) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
156 | $g = new ClassGenerator($namespace, $className, $classComments); |
||
157 | $g->setLogger($this->logger); |
||
158 | $config = new ClassConfig(); |
||
159 | $config->isInterface = true; |
||
160 | $g->generateClassType($properties, $this->modelClass, $this->modelComments, $config); |
||
161 | $g->createFileOnDir($directoryOutput); |
||
162 | $generated = true; //FIXME: use $g for determinate! -> take error from generator |
||
0 ignored issues
–
show
|
|||
163 | if ($generated) { |
||
164 | $this->fieldsClass[$namespace.'\\'.$className] = $properties['fields']; //ONLY IF VALID!!! |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
165 | } |
||
166 | // DOMANDA: perche' non passarle tutte?? |
||
167 | // if (array_key_exists('fields', $properties)) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
168 | // $types_field[$className] = $properties['fields']; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
169 | // } |
||
170 | // $this->generateClassType($fileInterface, $interface, $properties, $types_reference, $types_description, false, true, true, false, false, $filesystem, $io); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
69% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
171 | } |
||
172 | |||
173 | // NOTE: class aren't ddd type, we haven't section on ddd definition |
||
174 | View Code Duplication | if (in_array($dddType, ['class'])) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
175 | $g = new ClassGenerator($namespace, $className, $classComments); |
||
176 | $g->setLogger($this->logger); |
||
177 | $config = new ClassConfig(); |
||
178 | $config->isInterface = false; |
||
179 | $config->haveConstructor = true; |
||
180 | $g->generateClassType($properties, $this->modelClass, $this->modelComments, $config); |
||
181 | $g->createFileOnDir($directoryOutput); |
||
182 | $generated = true; //FIXME: use $g for determinate! -> take error from generator |
||
0 ignored issues
–
show
|
|||
183 | if ($generated) { |
||
184 | $this->fieldsClass[$namespace.'\\'.$className] = $properties['fields']; //ONLY IF VALID!!! |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
185 | } |
||
186 | // DOMANDA: perche' non passarle tutte?? |
||
187 | // if (array_key_exists('fields', $properties)) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
188 | // $types_field[$className] = $properties['fields']; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
189 | // } |
||
190 | // $this->generateClassType($fileInterface, $interface, $properties, $types_reference, $types_description, false, true, true, false, false, $filesystem, $io); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
69% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
191 | } |
||
192 | |||
193 | if (in_array($dddType, ['events'])) { |
||
194 | //FIXME: impossible! events exist in relation on aggregateRoot |
||
0 ignored issues
–
show
|
|||
195 | $this->error('events exist in relation on aggregateRoot', ['class' => $className]); |
||
196 | $this->errors[] = 'events exist in relation on aggregateRoot, event class '.$className.' cannot exist!'; |
||
197 | } |
||
198 | |||
199 | if (!$generated) { |
||
200 | $dddDefinition = $this->rym->getDomainDefinitionAttributes($dddType); |
||
201 | |||
202 | if (is_null($dddDefinition)) { |
||
203 | $this->error('Missing ddd reference for : '.$dddType.' into '.$className, ['class' => $className]); |
||
204 | $this->errors[] = 'Missing ddd reference for : '.$dddType.' into '.$className; |
||
205 | } else { |
||
206 | if (array_key_exists('package', $dddDefinition)) { |
||
207 | $namespace = $dddDefinition['package']; |
||
208 | } |
||
209 | |||
210 | if (empty($namespace)) { |
||
211 | $this->error('Missing namespace', ['class' => $className]); |
||
212 | $this->errors[] = 'Missing namespace for '.$className; |
||
213 | } |
||
214 | |||
215 | $createGetter = false; |
||
216 | $createSetter = false; |
||
217 | if (array_key_exists('getter', $dddDefinition)) { |
||
218 | $createGetter = $dddDefinition['getter']; |
||
219 | } |
||
220 | if (array_key_exists('setter', $dddDefinition)) { |
||
221 | $createSetter = $dddDefinition['setter']; |
||
222 | } |
||
223 | |||
224 | $isRootAggregate = $dddType == 'aggregate' && isset($properties['ddd']['root']) && boolval($properties['ddd']['root']) ? true : false; |
||
225 | |||
226 | $this->info('Method required', ['class' => $className, 'getter' => $createGetter, 'setter' => $createSetter, 'aggregateRoot' => $isRootAggregate]); |
||
227 | |||
228 | if (array_key_exists('extend', $dddDefinition)) { |
||
229 | $dddExtendDefinition = $dddDefinition['extend']; |
||
230 | if (!array_key_exists('extend', $properties)) { |
||
231 | $properties['extend'] = $dddExtendDefinition; //No multi-inheritance |
||
232 | } |
||
233 | } |
||
234 | |||
235 | $dddReferenceFields = []; |
||
236 | if (array_key_exists('fields', $dddDefinition)) { |
||
237 | foreach ($dddDefinition['fields'] as $key => $value) { |
||
238 | $dddReferenceFields[$key] = $value; |
||
239 | } |
||
240 | } |
||
241 | |||
242 | //TODO: gestire gli [] dentro la definizione del modello se serve... |
||
0 ignored issues
–
show
|
|||
243 | |||
244 | //TODO: aggiungere le validazioni |
||
0 ignored issues
–
show
|
|||
245 | // validationRule: |
||
246 | // events: |
||
247 | // create: |
||
248 | // fields: [ id, sessione, tipologiaCampo] |
||
249 | // delete: |
||
250 | // fields: [ id ] |
||
251 | // addDocument: |
||
252 | // fields: [ id, documentoCorrelato ] |
||
253 | |||
254 | if (array_key_exists('events', $properties)) { |
||
255 | //genero altre classi per ogni evento! |
||
256 | $eventsProperties = $this->rym->getDomainDefinitionAttributes('events'); |
||
257 | $eventsNamespace = $eventsProperties['package']; |
||
258 | $eventsImplement = ''; |
||
259 | if (array_key_exists('implement', $eventsProperties)) { |
||
260 | $eventsImplement = $eventsProperties['implement']; |
||
261 | } |
||
262 | |||
263 | $eventsExtend = ''; |
||
264 | if (array_key_exists('extend', $eventsProperties)) { |
||
265 | $eventsExtend = $eventsProperties['extend']; |
||
266 | } |
||
267 | |||
268 | if (!array_key_exists($eventsImplement, $this->modelClass)) { |
||
269 | $this->error('Missing implement class '.$eventsImplement, ['class' => $className]); |
||
270 | $this->errors[] = 'Missing implement '.$eventsImplement.' for '.$className; |
||
271 | continue; |
||
272 | } |
||
273 | $namespaceImplementClass = $this->modelClass[$eventsImplement]; |
||
274 | $eventsImplementFull = $namespaceImplementClass.'\\'.$eventsImplement; |
||
275 | |||
276 | $eventsField = []; |
||
277 | if (array_key_exists('fields', $eventsProperties)) { |
||
278 | foreach ($eventsProperties['fields'] as $key => $value) { |
||
279 | $eventsField[$key] = $value; |
||
280 | } |
||
281 | } |
||
282 | |||
283 | //field's inheritance |
||
284 | if (array_key_exists($eventsImplementFull, $this->fieldsClass)) { |
||
285 | $fieldsImplementClass = $this->fieldsClass[$eventsImplementFull]; |
||
286 | foreach ($fieldsImplementClass as $key => $value) { |
||
287 | $eventsField[$key] = $value; |
||
288 | } |
||
289 | } |
||
290 | |||
291 | $eventsToCreate = []; |
||
292 | if (array_key_exists('events', $properties)) { |
||
293 | $eventsToCreate = $properties['events']; |
||
294 | } |
||
295 | |||
296 | if (array_key_exists('events', $dddDefinition)) { |
||
297 | $eventsToCreate = array_merge($dddDefinition['events'], $eventsToCreate); |
||
298 | } |
||
299 | |||
300 | foreach ($eventsToCreate as $event) { |
||
301 | $eventClassName = $className.str_replace('_', '', ucwords($event, '_')).'Event'; |
||
302 | $eventClassComments = 'Event '.$event.' for Aggregate Root '.$className; |
||
303 | |||
304 | $propertiesEventClass = []; |
||
305 | if (!empty($eventsExtend)) { |
||
306 | $propertiesEventClass['extend'] = $eventsExtend; |
||
307 | } |
||
308 | if (!empty($eventsImplement)) { |
||
309 | $propertiesEventClass['implements'] = $eventsImplementFull; |
||
310 | } |
||
311 | |||
312 | $propertiesEventClass['fields'] = $eventsField; |
||
313 | |||
314 | $this->info('Create Event', ['event' => $event, 'class' => $className, 'extend' => $eventsExtend, 'implement' => $eventsImplementFull, 'fields' => $eventsField]); |
||
315 | |||
316 | $g = new ClassGenerator($eventsNamespace, $eventClassName, $eventClassComments); |
||
317 | $g->setLogger($this->logger); |
||
318 | $config = new ClassConfig(); |
||
319 | $config->isInterface = false; |
||
320 | $config->haveConstructor = true; |
||
321 | $config->isFinalClass = true; //don't wnat cycle dependency |
||
322 | $config->haveGetter = true; |
||
323 | $config->haveSetter = false; |
||
324 | $g->generateClassType($propertiesEventClass, $this->modelClass, $this->modelComments, $config); |
||
325 | $g->createFileOnDir($directoryOutput); |
||
326 | $generated = true; |
||
327 | } |
||
328 | |||
329 | if ($generated) { |
||
330 | $this->fieldsClass[$namespace.'\\'.$className] = $eventsField; //ONLY IF VALID!!! |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
331 | } |
||
332 | } |
||
333 | |||
334 | if (array_key_exists('enum', $properties)) { |
||
335 | $enumClassList = $properties['enum']; |
||
336 | foreach ($enumClassList as $enumClassName) { |
||
337 | $enumNamespace = $namespace.'\\'.$className; |
||
338 | $propertiesEnumClass = [ |
||
339 | 'extend' => $namespace.'\\'.$className, |
||
340 | ]; |
||
341 | $actionName = 'instance'; |
||
342 | $propertiesEnumClass['methods'] = []; |
||
343 | $propertiesEnumClass['methods'][$actionName] = []; |
||
344 | $propertiesEnumClass['methods'][$actionName]['params'] = []; |
||
345 | $propertiesEnumClass['methods'][$actionName]['static'] = true; |
||
346 | $propertiesEnumClass['methods'][$actionName]['@return'] = $enumNamespace.'\\'.$enumClassName; |
||
347 | $body = 'self::$instance = new '.$enumClassName.'();'; |
||
348 | $body .= 'return self::$instance;'; |
||
349 | $propertiesEnumClass['methods'][$actionName]['body'] = $body; |
||
350 | |||
351 | //TODO: pensare se qui va bene cosi... potrebbe il ClassGenerator sapere come fare questo costruttore? |
||
0 ignored issues
–
show
|
|||
352 | $actionName = '__construct'; |
||
353 | $propertiesEnumClass['methods'][$actionName] = []; |
||
354 | $propertiesEnumClass['methods'][$actionName]['visibility'] = 'private'; |
||
355 | $propertiesEnumClass['methods'][$actionName]['params'] = []; |
||
356 | $propertiesEnumClass['methods'][$actionName]['static'] = false; |
||
357 | $propertiesEnumClass['methods'][$actionName]['description'] = 'costruttore'; |
||
358 | $body = '$this->name = \''.$enumClassName.'\';'; |
||
359 | $propertiesEnumClass['methods'][$actionName]['body'] = $body; |
||
360 | |||
361 | $enumClassComments = 'Child of '.$className.' '.$enumClassName; |
||
362 | $g = new ClassGenerator($enumNamespace, $enumClassName, $enumClassComments); |
||
363 | $g->setLogger($this->logger); |
||
364 | $configEnum = new ClassConfig(); |
||
365 | $configEnum->isInterface = false; |
||
366 | $configEnum->haveConstructor = true; |
||
367 | $configEnum->isFinalClass = true; //don't wnat cycle dependency |
||
368 | $configEnum->haveGetter = true; |
||
369 | $configEnum->haveSetter = false; |
||
370 | $g->generateClassType($propertiesEnumClass, $this->modelClass, $this->modelComments, $configEnum); |
||
371 | $g->createFileOnDir($directoryOutput); |
||
372 | $generated = true; |
||
0 ignored issues
–
show
$generated is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
373 | } |
||
374 | |||
375 | $properties['fields']['name'] = [ |
||
376 | 'primitive' => 'string', |
||
377 | 'description' => 'nome esplicativo della enum', |
||
378 | 'getter' => true, |
||
379 | ]; |
||
380 | |||
381 | $config = new ClassConfig(); |
||
382 | $config->isInterface = false; |
||
383 | $config->haveConstructor = false; |
||
384 | $config->isFinalClass = false; |
||
385 | $config->isEnum = true; |
||
386 | $config->haveGetter = $createGetter; |
||
387 | $config->haveSetter = $createSetter; |
||
388 | } else { |
||
389 | $config = new ClassConfig(); |
||
390 | $config->isInterface = false; |
||
391 | $config->haveConstructor = true; |
||
392 | $config->isFinalClass = true; //don't wnat cycle dependency |
||
393 | $config->haveGetter = $createGetter; |
||
394 | $config->haveSetter = $createSetter; |
||
395 | } |
||
396 | |||
397 | //NORMAL GENERATION |
||
398 | $g = new ClassGenerator($namespace, $className, $classComments); |
||
399 | $g->setLogger($this->logger); |
||
400 | $g->generateClassType($properties, $this->modelClass, $this->modelComments, $config); |
||
401 | $g->createFileOnDir($directoryOutput); |
||
402 | $generated = true; |
||
403 | } |
||
404 | } |
||
405 | |||
406 | if ($generated) { |
||
407 | $this->modelClass[$className] = $namespace; |
||
408 | $this->modelComments[$className] = $classComments; |
||
409 | } |
||
410 | } //end class generation |
||
411 | } |
||
412 | } |
||
413 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.