Completed
Push — master ( bb050e...36e41a )
by Paweł
11:10
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 45

Duplication

Lines 45
Ratio 100 %

Code Coverage

Tests 42
CRAP Score 1

Importance

Changes 0
Metric Value
dl 45
loc 45
ccs 42
cts 42
cp 1
rs 9.2
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Facebook Instant Articles Bundle.
7
 *
8
 * Copyright 2016 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2016 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\FacebookInstantArticlesBundle\DependencyInjection;
18
19
use SWP\Bundle\FacebookInstantArticlesBundle\Model\Application;
20
use SWP\Bundle\FacebookInstantArticlesBundle\Model\ApplicationInterface;
21
use SWP\Bundle\FacebookInstantArticlesBundle\Model\Page;
22
use SWP\Bundle\FacebookInstantArticlesBundle\Model\PageInterface;
23
use SWP\Bundle\StorageBundle\Doctrine\ORM\EntityRepository;
24
use SWP\Component\Storage\Factory\Factory;
25
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
26
use Symfony\Component\Config\Definition\ConfigurationInterface;
27
28
/**
29
 * This is the class that validates and merges configuration from your app/config files.
30
 *
31
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
32
 */
33 View Code Duplication
class Configuration implements ConfigurationInterface
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
{
35
    /**
36
     * {@inheritdoc}
37
     */
38 1
    public function getConfigTreeBuilder()
39
    {
40 1
        $treeBuilder = new TreeBuilder();
41 1
        $treeBuilder->root('swp_facebook_instant_articles')
42 1
            ->children()
43 1
                ->arrayNode('persistence')
44 1
                    ->addDefaultsIfNotSet()
45 1
                    ->children()
46 1
                        ->arrayNode('orm')
47 1
                            ->addDefaultsIfNotSet()
48 1
                            ->canBeEnabled()
49 1
                            ->children()
50 1
                                ->arrayNode('classes')
51 1
                                    ->addDefaultsIfNotSet()
52 1
                                    ->children()
53 1
                                        ->arrayNode('facebook_application')
54 1
                                            ->addDefaultsIfNotSet()
55 1
                                            ->children()
56 1
                                                ->scalarNode('model')->cannotBeEmpty()->defaultValue(Application::class)->end()
57 1
                                                ->scalarNode('interface')->cannotBeEmpty()->defaultValue(ApplicationInterface::class)->end()
58 1
                                                ->scalarNode('repository')->defaultValue(EntityRepository::class)->end()
59 1
                                                ->scalarNode('factory')->defaultValue(Factory::class)->end()
60 1
                                                ->scalarNode('object_manager_name')->defaultValue(null)->end()
61 1
                                            ->end()
62 1
                                        ->end()
63 1
                                        ->arrayNode('facebook_page')
64 1
                                            ->addDefaultsIfNotSet()
65 1
                                            ->children()
66 1
                                                ->scalarNode('model')->cannotBeEmpty()->defaultValue(Page::class)->end()
67 1
                                                ->scalarNode('interface')->cannotBeEmpty()->defaultValue(PageInterface::class)->end()
68 1
                                                ->scalarNode('repository')->defaultValue(EntityRepository::class)->end()
69 1
                                                ->scalarNode('factory')->defaultValue(Factory::class)->end()
70 1
                                                ->scalarNode('object_manager_name')->defaultValue(null)->end()
71 1
                                            ->end()
72 1
                                        ->end()
73 1
                                    ->end()
74 1
                                ->end()
75 1
                            ->end()
76 1
                        ->end()
77 1
                    ->end()
78 1
                ->end()
79 1
            ->end();
80
81 1
        return $treeBuilder;
82
    }
83
}
84