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 ( 512ed0...66c291 )
by Bruno
01:45
created

PlaceholdersExtension::loadStepTester()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
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\PlaceholdersReplacer;
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 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
use Behat\Behat\Tester\ServiceContainer\TesterExtension;
16
use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension;
17
18
final class PlaceholdersExtension implements Extension
19
{
20
21
    const PLACEHOLDERS_REPLACER_ID = 'placeholders.replacer';
22
    const PLACEHOLDERS_REPOSITIORY_ID = 'placeholders.repository';
23
    const PLACEHOLDERS_CONTROLLER_ID = 'placeholders.controller';
24
    const VARIANTS_PREPROCESSOR_ID = 'placeholders.variants_preprocessor';
25
26
    /**
27
     * Returns the extension config key.
28
     *
29
     * @return string
30
     */
31
    public function getConfigKey()
32
    {
33
        return 'placeholders';
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function process(ContainerBuilder $container)
40
    {
41
        
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function initialize(ExtensionManager $extensionManager)
48
    {
49
        
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function configure(ArrayNodeDefinition $builder)
56
    {
57
        $builder
58
            ->addDefaultsIfNotSet()
59
            ->children()
60
            ->arrayNode('variant_tags')
61
            ->treatNullLike(array())
62
            ->info('Variant tags to iterate through')
63
            ->prototype('scalar')->end()
64
            ->end()
65
            ->arrayNode('config_tags')
66
            ->useAttributeAsKey('tag')
67
            ->prototype('scalar')->end()
68
            ->end()
69
            ->end()
70
            ->end();
71
    }
72
73
    /**
74
     * Loads extension services into temporary container.
75
     *
76
     * @param ContainerBuilder $container
77
     * @param array $config
78
     */
79
    public function load(ContainerBuilder $container, array $config)
80
    {
81
        $this->loadScenarioForkingFeatureTester($container, $config['variant_tags']);
82
        $this->loadPlaceholdersRepository($container, $config['config_tags']);
83
        $this->loadStepTester($container, $config['variant_tags'], 'default');
0 ignored issues
show
Unused Code introduced by
The call to PlaceholdersExtension::loadStepTester() has too many arguments starting with 'default'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
84
        $this->loadPlaceholdersController($container);
85
    }
86
87
    /**
88
     * @param ContainerBuilder $container
89
     */
90
    private function loadPlaceholdersController(ContainerBuilder $container)
91
    {
92
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Cli\PlaceholdersController', array(
93
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)));
94
        $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 1));
95
        $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition);
96
    }
97
98
    /**
99
     * Loads event-dispatching feature tester.
100
     *
101
     * @param ContainerBuilder $container
102
     */
103
    protected function loadPlaceholdersRepository(ContainerBuilder $container, $configs_mapping)
104
    {
105
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository', array(
106
            $configs_mapping
107
        ));
108
        $container->setDefinition(self::PLACEHOLDERS_REPOSITIORY_ID, $definition);
109
    }
110
111
    /**
112
     * Loads event-dispatching feature tester.
113
     *
114
     * @param ContainerBuilder $container
115
     */
116 View Code Duplication
    protected function loadScenarioForkingFeatureTester(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...
117
    {
118
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Tester\ScenarioBranchingFeatureTester', array(
119
            new Reference(TesterExtension::SPECIFICATION_TESTER_ID),
120
            $variantTags,
121
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)
122
        ));
123
        $definition->addTag(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG, array('priority' => 1000));
124
        $container->setDefinition(self::VARIANTS_PREPROCESSOR_ID, $definition);
125
    }
126
127
    /**
128
     * Loads step tester.
129
     *
130
     * @param ContainerBuilder $container
131
     */
132 View Code Duplication
    protected function loadStepTester(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...
133
    {
134
        $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Tester\PlaceholdersReplacer', array(
135
            new Reference(TesterExtension::STEP_TESTER_ID),
136
            $variantTags,
137
            new Reference(self::PLACEHOLDERS_REPOSITIORY_ID)
138
        ));
139
        $definition->addTag(TesterExtension::STEP_TESTER_WRAPPER_TAG);
140
        $container->setDefinition(self::PLACEHOLDERS_REPLACER_ID, $definition);
141
    }
142
}
143