Code Duplication    Length = 17-18 lines in 2 locations

Generator/DDDGenerator.php 2 locations

@@ 155-171 (lines=17) @@
152
153
            $generated = false;
154
            $dddType = $properties['ddd']['type'];
155
            if (in_array($dddType, ['interface'])) {
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
163
                if ($generated) {
164
                    $this->fieldsClass[$namespace.'\\'.$className] = $properties['fields']; //ONLY IF VALID!!!
165
                }
166
                // DOMANDA: perche' non passarle tutte??
167
                // if (array_key_exists('fields', $properties)) {
168
                //     $types_field[$className] = $properties['fields'];
169
                // }
170
                // $this->generateClassType($fileInterface, $interface, $properties, $types_reference, $types_description, false, true, true, false, false, $filesystem, $io);
171
            }
172
173
            // NOTE: class aren't ddd type, we haven't section on ddd definition
174
            if (in_array($dddType, ['class'])) {
@@ 174-191 (lines=18) @@
171
            }
172
173
            // NOTE: class aren't ddd type, we haven't section on ddd definition
174
            if (in_array($dddType, ['class'])) {
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
183
                if ($generated) {
184
                    $this->fieldsClass[$namespace.'\\'.$className] = $properties['fields']; //ONLY IF VALID!!!
185
                }
186
                // DOMANDA: perche' non passarle tutte??
187
                // if (array_key_exists('fields', $properties)) {
188
                //     $types_field[$className] = $properties['fields'];
189
                // }
190
                // $this->generateClassType($fileInterface, $interface, $properties, $types_reference, $types_description, false, true, true, false, false, $filesystem, $io);
191
            }
192
193
            if (in_array($dddType, ['events'])) {
194
                //FIXME: impossible! events exist in relation on aggregateRoot