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.
Completed
Push — master ( e88f87...0f9eb6 )
by Bruno
02:27
created

loadPlaceholdersRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
namespace Ciandt\Behat\PlaceholdersExtension\ServiceContainer;
3
4
use Behat\Behat\Tester\ServiceContainer\TesterExtension;
5
use Behat\Behat\Transformation\ServiceContainer\TransformationExtension;
6
use Behat\Testwork\Cli\ServiceContainer\CliExtension;
7
use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension;
8
use Behat\Testwork\ServiceContainer\Extension;
9
use Behat\Testwork\ServiceContainer\ExtensionManager;
10
use Ciandt\Behat\PlaceholdersExtension\Utils\PlaceholderUtils;
11
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
12
use Symfony\Component\DependencyInjection\ContainerBuilder;
13
use Symfony\Component\DependencyInjection\Definition;
14
use Symfony\Component\DependencyInjection\Reference;
15
16
final class PlaceholdersExtension implements Extension
17
{
18
19
    const PLACEHOLDERS_REPLACER_ID = 'placeholders.replacer';
20
    const PLACEHOLDERS_REPOSITIORY_ID = 'placeholders.repository';
21
    const PLACEHOLDERS_CONTROLLER_ID = 'placeholders.controller';
22
    const PLACEHOLDERS_TRANSFORMER_ID = 'placeholders.transformer';
23
    const VARIANTS_PREPROCESSOR_ID = 'placeholders.variants_preprocessor';
24
    const STEPS_DECORATOR_ID = 'placeholders.steps_decorator';
25
    const BEFORE_SCENARIO_SUBSCRIBER_ID = 'placeholders.before_scenario';
26
27
    /**
28
     * Returns the extension config key.
29
     *
30
     * @return string
31
     */
32
    public function getConfigKey()
33
    {
34
        return 'placeholders';
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function process(ContainerBuilder $container)
41
    {
42
        
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function initialize(ExtensionManager $extensionManager)
49
    {
50
        
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function configure(ArrayNodeDefinition $builder)
57
    {
58
        $builder
59
            ->addDefaultsIfNotSet()
60
            ->children()
61
            ->arrayNode('variant_tags')
62
            ->treatNullLike(array())
63
            ->info('Variant tags to iterate through')
64
            ->prototype('scalar')->end()
65
            ->end()
66
            ->arrayNode('config_tags')
67
            ->useAttributeAsKey('tag')
68
            ->prototype('scalar')->end()
69
            ->end()
70
            ->end()
71
            ->end();
72
    }
73
74
    /**
75
     * Loads extension services into temporary container.
76
     *
77
     * @param ContainerBuilder $container
78
     * @param array $config
79
     */
80
    public function load(ContainerBuilder $container, array $config)
81
    {
82
        $this->initializePlaceholderUtils($config['variant_tags'], $config['config_tags']);
83
        $this->loadScenarioBranchingFeatureTester($container, $config['variant_tags']);
84
        $this->loadPlaceholdersRepository($container, $config['config_tags']);
85
        $this->loadPlaceholdersController($container);
86
        $this->loadBeforeScenarioSubscriber($container);
87
        $this->loadPlaceholdersTransformer($container);
88
    }
89
90
    /**
91
     * @param ContainerBuilder $container
92
     */
93 View Code Duplication
    private function loadPlaceholdersController(ContainerBuilder $container)
0 ignored issues
show
Duplication introduced by
This method 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...
94
    {
95
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Cli\PlaceholdersController', array(
96
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)));
97
        $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 1));
98
        $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition);
99
    }
100
101
    protected function initializePlaceholderUtils($variantTags,$configTags){
102
        PlaceholderUtils::setVariantTags($variantTags);
103
        PlaceholderUtils::setConfigKeys(array_keys($configTags));
104
    }
105
106
107
    /**
108
     *
109
     * @param ContainerBuilder $container
110
     */
111
    protected function loadPlaceholdersRepository(ContainerBuilder $container, $configs_mapping)
112
    {
113
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository', array(
114
            $configs_mapping
115
        ));
116
        $container->setDefinition(self::PLACEHOLDERS_REPOSITIORY_ID, $definition);
117
    }
118
119
    /**
120
     *
121
     * @param ContainerBuilder $container
122
     */
123 View Code Duplication
    protected function loadScenarioBranchingFeatureTester(ContainerBuilder $container, $variantTags)
0 ignored issues
show
Unused Code introduced by
The parameter $variantTags is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method 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...
124
    {
125
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Tester\ScenarioBranchingFeatureTester', array(
126
            new Reference(TesterExtension::SPECIFICATION_TESTER_ID),
127
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)
128
        ));
129
        $definition->addTag(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG, array('priority' => 1000));
130
        $container->setDefinition(self::VARIANTS_PREPROCESSOR_ID, $definition);
131
    }
132
133
134
    /**
135
     * Loads transformers.
136
     *
137
     * @param ContainerBuilder $container
138
     */
139 View Code Duplication
    protected function loadPlaceholdersTransformer(ContainerBuilder $container)
0 ignored issues
show
Duplication introduced by
This method 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...
140
    {
141
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Transformer\PlaceholdersTransformer', array(
142
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID),
143
            new Reference(self::BEFORE_SCENARIO_SUBSCRIBER_ID)
144
        ));
145
        $definition->addTag(TransformationExtension::ARGUMENT_TRANSFORMER_TAG, array('priority' => 9999999));
146
        $container->setDefinition(self::PLACEHOLDERS_TRANSFORMER_ID, $definition);
147
    }
148
    
149
150 View Code Duplication
    protected function loadStepDecoratingScenarioTester(ContainerBuilder $container)
0 ignored issues
show
Duplication introduced by
This method 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...
151
    {
152
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Tester\StepDecoratingScenarioTester', array(
153
            new Reference(TesterExtension::SCENARIO_TESTER_ID)
154
        ));
155
        $definition->addTag(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => 9999999));
156
        $container->setDefinition(self::STEPS_DECORATOR_ID, $definition);
157
    }
158
    
159
    protected function loadBeforeScenarioSubscriber(ContainerBuilder $container){
160
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Subscriber\BeforeScenarioSubscriber');
161
        $definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG, array('priority' => 0));
162
        $container->setDefinition(self::BEFORE_SCENARIO_SUBSCRIBER_ID, $definition);
163
    }
164
}
165