Code Duplication    Length = 9-9 lines in 6 locations

src/Bundle/ResourceBundle/DependencyInjection/Extension/ResourceExtension.php 6 locations

@@ 126-134 (lines=9) @@
123
            $container->setAlias('lug.manager.'.$resource->getName(), $this->createManagerAlias($resource));
124
        }
125
126
        if ($resource->getRepository() !== null) {
127
            $repository = 'lug.repository.'.$resource->getName();
128
129
            if (class_exists($resource->getRepository())) {
130
                $container->setDefinition($repository, $this->createRepositoryDefinition($resource));
131
            } elseif ($repository !== $resource->getRepository()) {
132
                $container->setAlias($repository, $resource->getRepository());
133
            }
134
        }
135
136
        if ($resource->getFactory() !== null) {
137
            $factory = 'lug.factory.'.$resource->getName();
@@ 136-144 (lines=9) @@
133
            }
134
        }
135
136
        if ($resource->getFactory() !== null) {
137
            $factory = 'lug.factory.'.$resource->getName();
138
139
            if (class_exists($resource->getFactory())) {
140
                $container->setDefinition($factory, $this->createFactoryDefinition($resource));
141
            } elseif ($factory !== $resource->getFactory()) {
142
                $container->setAlias($factory, $resource->getFactory());
143
            }
144
        }
145
146
        if ($resource->getForm() !== null) {
147
            $form = 'lug.form.type.'.$resource->getName();
@@ 146-154 (lines=9) @@
143
            }
144
        }
145
146
        if ($resource->getForm() !== null) {
147
            $form = 'lug.form.type.'.$resource->getName();
148
149
            if (class_exists($resource->getForm())) {
150
                $container->setDefinition($form, $this->createFormDefinition($resource));
151
            } elseif ($form !== $resource->getForm()) {
152
                $container->setAlias($form, $resource->getForm());
153
            }
154
        }
155
156
        if ($resource->getChoiceForm() !== null) {
157
            $choiceForm = 'lug.form.type.'.$resource->getName().'.choice';
@@ 156-164 (lines=9) @@
153
            }
154
        }
155
156
        if ($resource->getChoiceForm() !== null) {
157
            $choiceForm = 'lug.form.type.'.$resource->getName().'.choice';
158
159
            if (class_exists($resource->getChoiceForm())) {
160
                $container->setDefinition($choiceForm, $this->createChoiceFormDefinition($resource));
161
            } elseif ($choiceForm !== $resource->getChoiceForm()) {
162
                $container->setAlias($choiceForm, $resource->getChoiceForm());
163
            }
164
        }
165
166
        if ($resource->getDomainManager() !== null) {
167
            $domainManager = 'lug.domain_manager.'.$resource->getName();
@@ 166-174 (lines=9) @@
163
            }
164
        }
165
166
        if ($resource->getDomainManager() !== null) {
167
            $domainManager = 'lug.domain_manager.'.$resource->getName();
168
169
            if (class_exists($resource->getDomainManager())) {
170
                $container->setDefinition($domainManager, $this->createDomainManagerDefinition($resource));
171
            } elseif ($domainManager !== $resource->getDomainManager()) {
172
                $container->setAlias($domainManager, $resource->getDomainManager());
173
            }
174
        }
175
176
        if ($resource->getController() !== null) {
177
            $controller = 'lug.controller.'.$resource->getName();
@@ 176-184 (lines=9) @@
173
            }
174
        }
175
176
        if ($resource->getController() !== null) {
177
            $controller = 'lug.controller.'.$resource->getName();
178
179
            if (class_exists($resource->getController())) {
180
                $container->setDefinition($controller, $this->createControllerDefinition($resource));
181
            } elseif ($controller !== $resource->getController()) {
182
                $container->setAlias($container, $resource->getController());
183
            }
184
        }
185
186
        $container->addObjectResource($resource);
187
    }