Completed
Push — master ( 5f4179...916f6e )
by Richard
11s
created

PhpSpecExtension   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 6
dl 0
loc 51
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 8 1
A configure() 0 10 1
A getConfigKey() 0 4 1
A initialize() 0 3 1
A process() 0 3 1
1
<?php
2
3
namespace RMiller\BehatSpec\Extension\PhpSpecExtension;
4
5
use Behat\Testwork\ServiceContainer\Extension as ExtensionInterface;
6
use Behat\Testwork\ServiceContainer\ExtensionManager;
7
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
8
use Symfony\Component\Config\FileLocator;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
11
12
class PhpSpecExtension implements ExtensionInterface
13
{
14
15
    /**
16
     * {@inheritDoc}
17
     */
18
    public function load(ContainerBuilder $container, array $config)
19
    {
20
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__));
21
        $loader->load('services.xml');
22
23
        $container->setParameter('phpspec_extension.path', $config['path']);
24
        $container->setParameter('phpspec_extension.config', $config['config']);
25
    }
26
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function configure(ArrayNodeDefinition $builder)
31
    {
32
        $builder
33
            ->addDefaultsIfNotSet()
34
            ->children()
35
                ->scalarNode('path')->defaultValue('bin/phpspec')->end()
36
                ->scalarNode('config')->defaultValue('phpspec.yml')->end()
37
            ->end()
38
        ->end();
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44
    public function getConfigKey()
45
    {
46
        return 'phpspec';
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function initialize(ExtensionManager $extensionManager)
53
    {
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59
    public function process(ContainerBuilder $container)
60
    {
61
    }
62
}
63