GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Configuration::addResourcesSection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 25
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 27
rs 9.52
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusReportPlugin\DependencyInjection;
6
7
use Odiseo\SyliusReportPlugin\Controller\ReportController;
8
use Odiseo\SyliusReportPlugin\Repository\ReportRepository;
9
use Odiseo\SyliusReportPlugin\Form\Type\ReportType;
10
use Odiseo\SyliusReportPlugin\Model\Report;
11
use Odiseo\SyliusReportPlugin\Model\ReportInterface;
12
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
13
use Sylius\Component\Resource\Factory\Factory;
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Symfony\Component\Config\Definition\ConfigurationInterface;
17
18
/**
19
 * This class contains the configuration information for the bundle.
20
 *
21
 * This information is solely responsible for how the different configuration
22
 * sections are normalized, and merged.
23
 *
24
 * @author Paweł Jędrzejewski <[email protected]>
25
 * @author Diego D'amico <[email protected]>
26
 */
27
final class Configuration implements ConfigurationInterface
28
{
29
    public function getConfigTreeBuilder(): TreeBuilder
30
    {
31
        $treeBuilder = new TreeBuilder('odiseo_sylius_report_plugin');
32
        $rootNode = $treeBuilder->getRootNode();
33
34
        $rootNode
35
            ->addDefaultsIfNotSet()
0 ignored issues
show
Bug introduced by
The method addDefaultsIfNotSet() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
            ->/** @scrutinizer ignore-call */ 
36
              addDefaultsIfNotSet()
Loading history...
36
            ->children()
37
                ->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
38
                ->scalarNode('renderer_configuration_template')->defaultValue('@OdiseoSyliusReportPlugin/_rendererConfiguration.html.twig')->end()
39
                ->scalarNode('data_fetcher_configuration_template')->defaultValue('@OdiseoSyliusReportPlugin/_dataFetcherConfiguration.html.twig')->end()
40
            ->end()
41
        ;
42
43
        $this->addResourcesSection($rootNode);
44
45
        return $treeBuilder;
46
    }
47
48
    private function addResourcesSection(ArrayNodeDefinition $node): void
49
    {
50
        $node
51
            ->children()
52
                ->arrayNode('resources')
53
                    ->addDefaultsIfNotSet()
54
                    ->children()
55
                        ->arrayNode('report')
56
                            ->addDefaultsIfNotSet()
57
                            ->children()
58
                                ->variableNode('options')->end()
59
                                ->arrayNode('classes')
0 ignored issues
show
Bug introduced by
The method arrayNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
                                ->/** @scrutinizer ignore-call */ arrayNode('classes')
Loading history...
60
                                    ->addDefaultsIfNotSet()
61
                                    ->children()
62
                                        ->scalarNode('model')->defaultValue(Report::class)->cannotBeEmpty()->end()
63
                                        ->scalarNode('interface')->defaultValue(ReportInterface::class)->cannotBeEmpty()->end()
64
                                        ->scalarNode('controller')->defaultValue(ReportController::class)->cannotBeEmpty()->end()
65
                                        ->scalarNode('repository')->defaultValue(ReportRepository::class)->cannotBeEmpty()->end()
66
                                        ->scalarNode('factory')->defaultValue(Factory::class)->end()
67
                                        ->scalarNode('form')->defaultValue(ReportType::class)->cannotBeEmpty()->end()
68
                                    ->end()
69
                                ->end()
70
                            ->end()
71
                        ->end()
72
                    ->end()
73
                ->end()
74
            ->end()
75
        ;
76
    }
77
}
78