@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Aggiungere il costruttore. |
39 | 39 | * |
40 | - * @return Nette\PhpGenerator\Method |
|
40 | + * @return Method |
|
41 | 41 | */ |
42 | 42 | private function addConstructor() |
43 | 43 | { |
@@ -51,6 +51,10 @@ discard block |
||
51 | 51 | return $mc; |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $comment |
|
56 | + * @param boolean $createGetter |
|
57 | + */ |
|
54 | 58 | private function addSingleton($comment, $createGetter) |
55 | 59 | { |
56 | 60 | $this->info('Aggiungo supporto singleton', [ |
@@ -76,6 +80,9 @@ discard block |
||
76 | 80 | $field->addComment($comment)->addComment('@var '.$fullClassName); |
77 | 81 | } |
78 | 82 | |
83 | + /** |
|
84 | + * @param boolean $isConcrete |
|
85 | + */ |
|
79 | 86 | private function addGetter($fieldName, $fieldClassFull, $isStatic, $isConcrete) |
80 | 87 | { |
81 | 88 | $this->info('Aggiungo getter', [ |
@@ -115,6 +122,9 @@ discard block |
||
115 | 122 | ]); |
116 | 123 | } |
117 | 124 | |
125 | + /** |
|
126 | + * @param boolean $isConcrete |
|
127 | + */ |
|
118 | 128 | private function addSetter($fieldName, $fieldClassFull, $isStatic, $isConcrete) |
119 | 129 | { |
120 | 130 | $this->info('Aggiungo setter', [ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | private function addSingleton($comment, $createGetter) |
55 | 55 | { |
56 | 56 | $this->info('Aggiungo supporto singleton', [ |
57 | - 'class' => $this->currentClass->getName(), |
|
57 | + 'class' => $this->currentClass->getName(), |
|
58 | 58 | ]); |
59 | 59 | $fullClassName = $this->currentClass->getNamespace()->getName().'\\'.$this->currentClass->getName(); |
60 | 60 | if ($createGetter) { |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | private function addGetter($fieldName, $fieldClassFull, $isStatic, $isConcrete) |
80 | 80 | { |
81 | 81 | $this->info('Aggiungo getter', [ |
82 | - 'class' => $this->currentClass->getName(), |
|
83 | - 'field' => $fieldName, |
|
84 | - 'type' => $fieldClassFull, |
|
85 | - 'static' => $isStatic, |
|
86 | - 'concrete' => $isConcrete, |
|
82 | + 'class' => $this->currentClass->getName(), |
|
83 | + 'field' => $fieldName, |
|
84 | + 'type' => $fieldClassFull, |
|
85 | + 'static' => $isStatic, |
|
86 | + 'concrete' => $isConcrete, |
|
87 | 87 | ]); |
88 | 88 | |
89 | 89 | /** $methodGetter @var \Nette\PhpGenerator\Method */ |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | $this->currentClass->getNamespace()->addUse($traitFull); |
111 | 111 | $this->currentClass->addTrait($traitFull); |
112 | 112 | $this->info('Add trait', [ |
113 | - 'class' => $this->currentClass->getName(), |
|
114 | - 'trait' => $traitFull, |
|
113 | + 'class' => $this->currentClass->getName(), |
|
114 | + 'trait' => $traitFull, |
|
115 | 115 | ]); |
116 | 116 | } |
117 | 117 | |
118 | 118 | private function addSetter($fieldName, $fieldClassFull, $isStatic, $isConcrete) |
119 | 119 | { |
120 | 120 | $this->info('Aggiungo setter', [ |
121 | - 'class' => $this->currentClass->getName(), |
|
122 | - 'field' => $fieldName, |
|
123 | - 'type' => $fieldClassFull, |
|
124 | - 'static' => $isStatic, |
|
125 | - 'concrete' => $isConcrete, |
|
121 | + 'class' => $this->currentClass->getName(), |
|
122 | + 'field' => $fieldName, |
|
123 | + 'type' => $fieldClassFull, |
|
124 | + 'static' => $isStatic, |
|
125 | + 'concrete' => $isConcrete, |
|
126 | 126 | ]); |
127 | 127 | |
128 | 128 | /** $methodSetter @var \Nette\PhpGenerator\Method */ |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $fieldClassFull = $this->currentClass->getNamespace()->getName().'\\'.$this->currentClass->getName(); |
148 | 148 | |
149 | 149 | $this->info('Aggiungo parseString', [ |
150 | - 'class' => $this->currentClass->getName(), |
|
150 | + 'class' => $this->currentClass->getName(), |
|
151 | 151 | ]); |
152 | 152 | |
153 | 153 | /** $methodParseString @var \Nette\PhpGenerator\Method */ |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | if (array_key_exists('extend', $properties)) { |
193 | 193 | $extendClassName = $properties['extend']; |
194 | 194 | $this->info('Aggiungo extend', [ |
195 | - 'class' => $this->currentClass->getName(), |
|
196 | - 'extend' => $extendClassName, |
|
195 | + 'class' => $this->currentClass->getName(), |
|
196 | + 'extend' => $extendClassName, |
|
197 | 197 | ]); |
198 | 198 | $this->currentClass->setExtends($extendClassName); |
199 | 199 | $this->currentClass->getNamespace()->addUse($extendClassName); |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | $this->currentClass->setImplements($implementsList); |
211 | 211 | foreach ($implementsList as $implementUse) { |
212 | 212 | $this->info('Aggiungo implement', [ |
213 | - 'class' => $this->currentClass->getName(), |
|
214 | - 'implements' => $implementUse, |
|
213 | + 'class' => $this->currentClass->getName(), |
|
214 | + 'implements' => $implementUse, |
|
215 | 215 | ]); |
216 | 216 | $this->currentClass->getNamespace()->addUse($implementUse); |
217 | 217 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $body .= '} else {'."\n"; |
302 | 302 | $body .= ' $this->'.$name.' = '.$defaultValue.';'."\n"; |
303 | 303 | $body .= '}'."\n"; |
304 | - // $body .= '$this->'.$name.' = '.$defaultValue.';'."\n"; |
|
304 | + // $body .= '$this->'.$name.' = '.$defaultValue.';'."\n"; |
|
305 | 305 | } else { |
306 | 306 | $body .= 'if ( is_null($'.$name.') ) {'."\n"; |
307 | 307 | $body .= ' $this->'.$name.' = '.$defaultValue.';'."\n"; |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | $fieldNamespace = $typesReference[$fieldClassName]; |
324 | 324 | $fieldClassFull = $fieldNamespace.'\\'.$fieldClassName; |
325 | 325 | $this->info('Trovato field namespace tra le reference', [ |
326 | - 'class' => $this->currentClass->getName(), |
|
327 | - 'field' => $fieldClassName, |
|
328 | - 'className' => $fieldClassFull, |
|
326 | + 'class' => $this->currentClass->getName(), |
|
327 | + 'field' => $fieldClassName, |
|
328 | + 'className' => $fieldClassFull, |
|
329 | 329 | ]); |
330 | 330 | } else { |
331 | 331 | //FIXME: strpos is better |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | } else { |
336 | 336 | $fieldClassFull = $phpNamespace->getName().'\\'.$fieldClassName; |
337 | 337 | $this->info('Uso class for field same namespace', [ |
338 | - 'class' => $this->currentClass->getName(), |
|
339 | - 'field' => $fieldClassName, |
|
340 | - 'className' => $fieldClassFull, |
|
338 | + 'class' => $this->currentClass->getName(), |
|
339 | + 'field' => $fieldClassName, |
|
340 | + 'className' => $fieldClassFull, |
|
341 | 341 | ]); |
342 | 342 | } |
343 | 343 | } |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | } |
362 | 362 | } else { |
363 | 363 | $this->info('Skip parametro al costruttore -> autoinizialize true', [ |
364 | - 'class' => $this->currentClass->getName(), |
|
365 | - 'parameter' => $name, |
|
366 | - 'className' => $fieldClassFull, |
|
367 | - 'default' => $defaultValue, |
|
368 | - 'autoinizialize' => $isAutoinizialize, |
|
364 | + 'class' => $this->currentClass->getName(), |
|
365 | + 'parameter' => $name, |
|
366 | + 'className' => $fieldClassFull, |
|
367 | + 'default' => $defaultValue, |
|
368 | + 'autoinizialize' => $isAutoinizialize, |
|
369 | 369 | ]); |
370 | 370 | } |
371 | 371 | } |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | if (!$isAutoinizialize) { |
393 | 393 | if (is_null($defaultValue)) { |
394 | 394 | $this->info('Aggiungo parametro al costruttore', [ |
395 | - 'class' => $this->currentClass->getName(), |
|
396 | - 'parameter' => $name, |
|
397 | - 'className' => $fieldClassFull, |
|
398 | - 'default' => $defaultValue, |
|
399 | - 'autoinizialize' => $isAutoinizialize, |
|
395 | + 'class' => $this->currentClass->getName(), |
|
396 | + 'parameter' => $name, |
|
397 | + 'className' => $fieldClassFull, |
|
398 | + 'default' => $defaultValue, |
|
399 | + 'autoinizialize' => $isAutoinizialize, |
|
400 | 400 | ]); |
401 | 401 | |
402 | 402 | //PHP7 ONLY |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | } |
425 | 425 | |
426 | 426 | $this->info('Check autoinizialize field', [ |
427 | - 'class' => $this->currentClass->getName(), |
|
428 | - 'field' => $name, |
|
429 | - 'autoinizialize' => $isAutoinizialize, |
|
430 | - 'default' => $defaultValue, |
|
427 | + 'class' => $this->currentClass->getName(), |
|
428 | + 'field' => $name, |
|
429 | + 'autoinizialize' => $isAutoinizialize, |
|
430 | + 'default' => $defaultValue, |
|
431 | 431 | ]); |
432 | 432 | |
433 | 433 | $comment = 'no description available'; |
@@ -492,9 +492,9 @@ discard block |
||
492 | 492 | |
493 | 493 | foreach ($properties['methods'] as $methodName => $methodsProperties) { |
494 | 494 | $this->info('Aggiungo method', [ |
495 | - 'class' => $this->currentClass->getName(), |
|
496 | - 'methodName' => $methodName, |
|
497 | - 'methodProp' => $methodsProperties, |
|
495 | + 'class' => $this->currentClass->getName(), |
|
496 | + 'methodName' => $methodName, |
|
497 | + 'methodProp' => $methodsProperties, |
|
498 | 498 | ]); |
499 | 499 | |
500 | 500 | /** $newMethodCall @var \Nette\PhpGenerator\Method */ |
@@ -260,7 +260,7 @@ |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if (!$isAutoinizialize) { |
263 | - if (null != $defaultValue) { |
|
263 | + if (null != $defaultValue) { |
|
264 | 264 | //TODO: usare "primitive type per determinare il corretto IF" |
265 | 265 | //FARE UN TEST PER I BOOLEAN |
266 | 266 | //@see https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ |
@@ -86,6 +86,9 @@ discard block |
||
86 | 86 | $this->rym->readYaml($fullPathFile); |
87 | 87 | } |
88 | 88 | |
89 | + /** |
|
90 | + * @param string $message |
|
91 | + */ |
|
89 | 92 | private function info($message, $context = []) |
90 | 93 | { |
91 | 94 | if (!is_null($this->logger)) { |
@@ -93,6 +96,9 @@ discard block |
||
93 | 96 | } |
94 | 97 | } |
95 | 98 | |
99 | + /** |
|
100 | + * @param string $message |
|
101 | + */ |
|
96 | 102 | private function error($message, $context = []) |
97 | 103 | { |
98 | 104 | if (!is_null($this->logger)) { |
@@ -113,7 +119,7 @@ discard block |
||
113 | 119 | /** |
114 | 120 | * [generate description]. |
115 | 121 | * |
116 | - * @param string $directoryOutput directory where write generated class |
|
122 | + * @param Local $directoryOutput directory where write generated class |
|
117 | 123 | */ |
118 | 124 | public function generate(Local $directoryOutput) |
119 | 125 | { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | foreach ($enumClassList as $enumClassName) { |
331 | 331 | $enumNamespace = $namespace.'\\'.$className; |
332 | 332 | $propertiesEnumClass = [ |
333 | - 'extend' => $namespace.'\\'.$className, |
|
333 | + 'extend' => $namespace.'\\'.$className, |
|
334 | 334 | ]; |
335 | 335 | $actionName = 'instance'; |
336 | 336 | $propertiesEnumClass['methods'] = []; |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | $properties['fields']['name'] = [ |
370 | - 'primitive' => 'string', |
|
371 | - 'description' => 'nome esplicativo della enum', |
|
372 | - 'getter' => true, |
|
370 | + 'primitive' => 'string', |
|
371 | + 'description' => 'nome esplicativo della enum', |
|
372 | + 'getter' => true, |
|
373 | 373 | ]; |
374 | 374 | |
375 | 375 | $config = new ClassConfig(); |
@@ -65,6 +65,9 @@ |
||
65 | 65 | $str = ucfirst($str); |
66 | 66 | } |
67 | 67 | |
68 | + /** |
|
69 | + * @param string $ramlFile |
|
70 | + */ |
|
68 | 71 | public function generateRest($ramlFile, Local $directoryOutput) |
69 | 72 | { |
70 | 73 | $parser = new Parser(); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | final class CAMEG extends TipologiaCampo |
11 | 11 | { |
12 | 12 | /** |
13 | - * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo\CAMEG |
|
13 | + * @return CAMEG |
|
14 | 14 | */ |
15 | 15 | final public static function instance() |
16 | 16 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | final class CAMLC extends TipologiaCampo |
11 | 11 | { |
12 | 12 | /** |
13 | - * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo\CAMLC |
|
13 | + * @return CAMLC |
|
14 | 14 | */ |
15 | 15 | final public static function instance() |
16 | 16 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | final class CAMRS extends TipologiaCampo |
11 | 11 | { |
12 | 12 | /** |
13 | - * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo\CAMRS |
|
13 | + * @return CAMRS |
|
14 | 14 | */ |
15 | 15 | final public static function instance() |
16 | 16 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | final class CCG extends TipologiaCampo |
11 | 11 | { |
12 | 12 | /** |
13 | - * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo\CCG |
|
13 | + * @return CCG |
|
14 | 14 | */ |
15 | 15 | final public static function instance() |
16 | 16 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | final class CFMEG extends TipologiaCampo |
11 | 11 | { |
12 | 12 | /** |
13 | - * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo\CFMEG |
|
13 | + * @return CFMEG |
|
14 | 14 | */ |
15 | 15 | final public static function instance() |
16 | 16 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | final class CFMLC extends TipologiaCampo |
11 | 11 | { |
12 | 12 | /** |
13 | - * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo\CFMLC |
|
13 | + * @return CFMLC |
|
14 | 14 | */ |
15 | 15 | final public static function instance() |
16 | 16 | { |