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

PhpSpecExtension::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 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