Code Duplication    Length = 10-13 lines in 3 locations

DependencyInjection/FOSRestExtension.php 3 locations

@@ 184-196 (lines=13) @@
181
182
    private function loadFormatListener(array $config, XmlFileLoader $loader, ContainerBuilder $container)
183
    {
184
        if ($config['format_listener']['enabled'] && !empty($config['format_listener']['rules'])) {
185
            $loader->load('format_listener.xml');
186
187
            if (!empty($config['format_listener']['service'])) {
188
                $service = $container->getDefinition('fos_rest.format_listener');
189
                $service->clearTag('kernel.event_listener');
190
            }
191
192
            $container->setParameter(
193
                'fos_rest.format_listener.rules',
194
                $config['format_listener']['rules']
195
            );
196
        }
197
    }
198
199
    private function loadVersioning(array $config, XmlFileLoader $loader, ContainerBuilder $container)
@@ 277-286 (lines=10) @@
274
            }
275
        }
276
277
        if ($config['view']['mime_types']['enabled']) {
278
            $loader->load('mime_type_listener.xml');
279
280
            if (!empty($config['mime_type_listener']['service'])) {
281
                $service = $container->getDefinition('fos_rest.mime_type_listener');
282
                $service->clearTag('kernel.event_listener');
283
            }
284
285
            $container->getDefinition('fos_rest.mime_type_listener')->replaceArgument(0, $config['view']['mime_types']['formats']);
286
        }
287
288
        if ($config['view']['view_response_listener']['enabled']) {
289
            $loader->load('view_response_listener.xml');
@@ 288-297 (lines=10) @@
285
            $container->getDefinition('fos_rest.mime_type_listener')->replaceArgument(0, $config['view']['mime_types']['formats']);
286
        }
287
288
        if ($config['view']['view_response_listener']['enabled']) {
289
            $loader->load('view_response_listener.xml');
290
            $service = $container->getDefinition('fos_rest.view_response_listener');
291
292
            if (!empty($config['view_response_listener']['service'])) {
293
                $service->clearTag('kernel.event_listener');
294
            }
295
296
            $service->replaceArgument(1, $config['view']['view_response_listener']['force']);
297
        }
298
299
        $formats = [];
300
        foreach ($config['view']['formats'] as $format => $enabled) {