FOSCKEditorExtension   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 41
ccs 0
cts 28
cp 0
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAlias() 0 3 1
A loadResources() 0 16 2
A loadInternal() 0 13 2
1
<?php
2
3
/*
4
 * This file is part of the FOSCKEditor Bundle.
5
 *
6
 * (c) 2018 - present  Friends of Symfony
7
 * (c) 2009 - 2017     Eric GELOEN <[email protected]>
8
 *
9
 * For the full copyright and license information, please read the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace FOS\CKEditorBundle\DependencyInjection;
14
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
18
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
19
20
/**
21
 * @author GeLo <[email protected]>
22
 */
23
final class FOSCKEditorExtension extends ConfigurableExtension
24
{
25
    protected function loadInternal(array $config, ContainerBuilder $container): void
26
    {
27
        $this->loadResources($container);
28
29
        $container->getDefinition('fos_ck_editor.configuration')
30
            ->setArgument(0, $config);
31
32
        $bundles = $container->getParameter('kernel.bundles');
33
34
        if (isset($bundles['IvoryCKEditorBundle'])) {
35
            @trigger_error(
36
                "IvoryCKEditorBundle isn't maintained anymore and should be replaced with FOSCKEditorBundle.",
37
                E_USER_DEPRECATED
38
            );
39
        }
40
    }
41
42
    private function loadResources(ContainerBuilder $container): void
43
    {
44
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
45
46
        $resources = [
47
            'builder',
48
            'command',
49
            'config',
50
            'form',
51
            'installer',
52
            'renderer',
53
            'twig',
54
        ];
55
56
        foreach ($resources as $resource) {
57
            $loader->load($resource.'.xml');
58
        }
59
    }
60
61
    public function getAlias(): string
62
    {
63
        return 'fos_ck_editor';
64
    }
65
}
66