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 ( 04d873...1e92a2 )
by Bruno
03:39
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 Behat\Behat\Gherkin\ServiceContainer\GherkinExtension;
5
use Behat\Behat\Tester\ServiceContainer\TesterExtension;
6
use Behat\Behat\Transformation\ServiceContainer\TransformationExtension;
7
use Behat\Testwork\Cli\ServiceContainer\CliExtension;
8
use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension;
9
use Behat\Testwork\ServiceContainer\Extension;
10
use Behat\Testwork\ServiceContainer\ExtensionManager;
11
use Ciandt\Behat\PlaceholdersExtension\Utils\PlaceholderUtils;
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
17
final class PlaceholdersExtension implements Extension
18
{
19
20
    const PLACEHOLDERS_REPLACER_ID = 'placeholders.replacer';
21
    const PLACEHOLDERS_REPOSITIORY_ID = 'placeholders.repository';
22
    const PLACEHOLDERS_CONTROLLER_ID = 'placeholders.controller';
23
    const PLACEHOLDERS_TRANSFORMER_ID = 'placeholders.transformer';
24
    const VARIANTS_PREPROCESSOR_ID = 'placeholders.variants_preprocessor';
25
    const STEPS_DECORATOR_ID = 'placeholders.steps_decorator';
26
    const BEFORE_SCENARIO_SUBSCRIBER_ID = 'placeholders.before_scenario';
27
28
    /**
29
     * Returns the extension config key.
30
     *
31
     * @return string
32
     */
33
    public function getConfigKey()
34
    {
35
        return 'placeholders';
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function process(ContainerBuilder $container)
42
    {
43
        
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function initialize(ExtensionManager $extensionManager)
50
    {
51
        
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function configure(ArrayNodeDefinition $builder)
58
    {
59
        $builder
60
            ->addDefaultsIfNotSet()
61
            ->children()
62
            ->arrayNode('variant_tags')
63
            ->treatNullLike(array())
64
            ->info('Variant tags to iterate through')
65
            ->prototype('scalar')->end()
66
            ->end()
67
            ->arrayNode('config_tags')
68
            ->useAttributeAsKey('tag')
69
            ->prototype('scalar')->end()
70
            ->end()
71
            ->end()
72
            ->end();
73
    }
74
75
    /**
76
     * Loads extension services into temporary container.
77
     *
78
     * @param ContainerBuilder $container
79
     * @param array $config
80
     */
81
    public function load(ContainerBuilder $container, array $config)
82
    {
83
        $this->initializePlaceholderUtils($config['variant_tags'], $config['config_tags']);
84
        $this->loadScenarioBranchingFileLoader($container);
85
        $this->loadPlaceholdersRepository($container, $config['config_tags']);
86
        $this->loadPlaceholdersController($container);
87
        $this->loadBeforeScenarioSubscriber($container);
88
        $this->loadPlaceholdersTransformer($container);
89
    }
90
91
    /**
92
     * @param ContainerBuilder $container
93
     */
94 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...
95
    {
96
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Cli\PlaceholdersController', array(
97
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)));
98
        $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 1));
99
        $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition);
100
    }
101
102
    protected function initializePlaceholderUtils($variantTags, $configTags)
103
    {
104
        PlaceholderUtils::setVariantTags($variantTags);
105
        PlaceholderUtils::setConfigKeys(array_keys($configTags));
106
    }
107
108
109
    /**
110
     *
111
     * @param ContainerBuilder $container
112
     */
113
    protected function loadPlaceholdersRepository(ContainerBuilder $container, $configs_mapping)
114
    {
115
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository', array(
116
            $configs_mapping
117
        ));
118
        $container->setDefinition(self::PLACEHOLDERS_REPOSITIORY_ID, $definition);
119
    }
120
121
    /**
122
     *
123
     * @param ContainerBuilder $container
124
     */
125
    protected function loadScenarioBranchingFileLoader(ContainerBuilder $container)
126
    {
127
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Gherkin\ScenarioBranchingFileLoader', array(
128
            new Reference('gherkin.parser'),
129
            new Definition('Behat\Gherkin\Cache\MemoryCache')
130
        ));
131
        $definition->addTag(GherkinExtension::LOADER_TAG, array('priority' => 100));
132
        $container->setDefinition(self::VARIANTS_PREPROCESSOR_ID, $definition);
133
    }
134
135
136
    /**
137
     * Loads transformers.
138
     *
139
     * @param ContainerBuilder $container
140
     */
141 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...
142
    {
143
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Transformer\PlaceholdersTransformer', array(
144
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID),
145
            new Reference(self::BEFORE_SCENARIO_SUBSCRIBER_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
    protected function loadBeforeScenarioSubscriber(ContainerBuilder $container)
162
    {
163
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Subscriber\BeforeScenarioSubscriber');
164
        $definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG, array('priority' => 0));
165
        $container->setDefinition(self::BEFORE_SCENARIO_SUBSCRIBER_ID, $definition);
166
    }
167
}
168