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 ( 66c291...444f0e )
by Bruno
03:49
created

loadScenarioBranchingFeatureTester()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
namespace Ciandt\Behat\PlaceholdersExtension\ServiceContainer;
3
4
use Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository;
5
use Ciandt\Behat\PlaceholdersExtension\Tester\PerVariantScenarioTester;
6
use Ciandt\Behat\PlaceholdersExtension\Tester\PlaceholderReplacingStepTester;
7
use Ciandt\Behat\PlaceholdersExtension\Utils\PlaceholderUtils;
8
use Behat\Testwork\Cli\ServiceContainer\CliExtension;
9
use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension;
10
use Behat\Testwork\ServiceContainer\Extension;
11
use Behat\Testwork\ServiceContainer\ExtensionManager;
12
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Definition;
15
use Symfony\Component\DependencyInjection\Reference;
16
use Behat\Behat\Tester\ServiceContainer\TesterExtension;
17
use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension;
18
use Behat\Behat\Transformation\ServiceContainer\TransformationExtension;
19
20
final class PlaceholdersExtension implements Extension
21
{
22
23
    const PLACEHOLDERS_REPLACER_ID = 'placeholders.replacer';
24
    const PLACEHOLDERS_REPOSITIORY_ID = 'placeholders.repository';
25
    const PLACEHOLDERS_CONTROLLER_ID = 'placeholders.controller';
26
    const PLACEHOLDERS_TRANSFORMER_ID = 'placeholders.transformer';
27
    const VARIANTS_PREPROCESSOR_ID = 'placeholders.variants_preprocessor';
28
    const STEPS_DECORATOR_ID = 'placeholders.steps_decorator';
29
30
    /**
31
     * Returns the extension config key.
32
     *
33
     * @return string
34
     */
35
    public function getConfigKey()
36
    {
37
        return 'placeholders';
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function process(ContainerBuilder $container)
44
    {
45
        
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function initialize(ExtensionManager $extensionManager)
52
    {
53
        
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function configure(ArrayNodeDefinition $builder)
60
    {
61
        $builder
62
            ->addDefaultsIfNotSet()
63
            ->children()
64
            ->arrayNode('variant_tags')
65
            ->treatNullLike(array())
66
            ->info('Variant tags to iterate through')
67
            ->prototype('scalar')->end()
68
            ->end()
69
            ->arrayNode('config_tags')
70
            ->useAttributeAsKey('tag')
71
            ->prototype('scalar')->end()
72
            ->end()
73
            ->end()
74
            ->end();
75
    }
76
77
    /**
78
     * Loads extension services into temporary container.
79
     *
80
     * @param ContainerBuilder $container
81
     * @param array $config
82
     */
83
    public function load(ContainerBuilder $container, array $config)
84
    {
85
        $this->initializePlaceholderUtils($config['variant_tags'], $config['config_tags']);
86
        $this->loadScenarioBranchingFeatureTester($container, $config['variant_tags']);
87
        $this->loadStepDecoratingScenarioTester($container);
88
        $this->loadPlaceholdersRepository($container, $config['config_tags']);
89
        $this->loadPlaceholdersController($container);
90
        $this->loadPlaceholdersTransformer($container);
91
    }
92
93
    /**
94
     * @param ContainerBuilder $container
95
     */
96 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...
97
    {
98
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Cli\PlaceholdersController', array(
99
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)));
100
        $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 1));
101
        $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition);
102
    }
103
104
    protected function initializePlaceholderUtils($variantTags,$configTags){
105
        PlaceholderUtils::setVariantTags($variantTags);
106
        PlaceholderUtils::setConfigKeys(array_keys($configTags));
107
    }
108
109
110
    /**
111
     *
112
     * @param ContainerBuilder $container
113
     */
114
    protected function loadPlaceholdersRepository(ContainerBuilder $container, $configs_mapping)
115
    {
116
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository', array(
117
            $configs_mapping
118
        ));
119
        $container->setDefinition(self::PLACEHOLDERS_REPOSITIORY_ID, $definition);
120
    }
121
122
    /**
123
     *
124
     * @param ContainerBuilder $container
125
     */
126 View Code Duplication
    protected function loadScenarioBranchingFeatureTester(ContainerBuilder $container, $variantTags)
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...
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...
127
    {
128
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Tester\ScenarioBranchingFeatureTester', array(
129
            new Reference(TesterExtension::SPECIFICATION_TESTER_ID),
130
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)
131
        ));
132
        $definition->addTag(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG, array('priority' => 1000));
133
        $container->setDefinition(self::VARIANTS_PREPROCESSOR_ID, $definition);
134
    }
135
136
137
    /**
138
     * Loads transformers.
139
     *
140
     * @param ContainerBuilder $container
141
     */
142 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...
143
    {
144
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Transformer\PlaceholdersTransformer', array(
145
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)
146
        ));
147
        $definition->addTag(TransformationExtension::ARGUMENT_TRANSFORMER_TAG, array('priority' => 9999999));
148
        $container->setDefinition(self::PLACEHOLDERS_TRANSFORMER_ID, $definition);
149
    }
150
    
151
152 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...
153
    {
154
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Tester\StepDecoratingScenarioTester', array(
155
            new Reference(TesterExtension::SCENARIO_TESTER_ID)
156
        ));
157
        $definition->addTag(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => 9999999));
158
        $container->setDefinition(self::STEPS_DECORATOR_ID, $definition);
159
    }
160
}
161