Failed Conditions
Pull Request — master (#25)
by Yo
05:43 queued 02:51
created

LoggerSubExtension   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 5
dl 0
loc 62
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigKey() 0 4 1
A initialize() 0 3 1
A configure() 0 20 1
A load() 0 3 1
A process() 0 3 1
1
<?php
2
namespace Yoanm\Behat3SymfonyExtension\ServiceContainer\SubExtension;
3
4
use Behat\Testwork\ServiceContainer\ExtensionManager;
5
use Monolog\Logger;
6
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Yoanm\Behat3SymfonyExtension\ServiceContainer\AbstractExtension;
9
10
class LoggerSubExtension extends AbstractExtension
11
{
12
    /**
13
     * @inheritDoc
14
     */
15 1
    public function getConfigKey()
16
    {
17 1
        return 'logger';
18
    }
19
20
    // @codeCoverageIgnoreStart
21
    // Not possible to cover this because ExtensionManager is a final class
22
    // Will be covered by FT
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function initialize(ExtensionManager $extensionManager)
27
    {
28
    }
29
    // @codeCoverageIgnoreEnd
30
31
    // @codeCoverageIgnoreStart
32
    // Will be covered by FT
33
    /**
34
     * @inheritDoc
35
     */
36
    public function configure(ArrayNodeDefinition $builder)
37
    {
38
        $builder
39
            ->addDefaultsIfNotSet()
40
            ->children()
41
                ->scalarNode('path')
42
                    ->defaultValue('var/log/behat.log')
43
                ->end()
44
                ->scalarNode('level')
45
                    ->beforeNormalization()
46
                    ->always()
47
                    ->then(function ($value) {
48
                        return Logger::toMonologLevel($value);
49
                    })
50
                    ->end()
51
                    ->defaultValue(Logger::DEBUG)
52
                ->end()
53
            ->end()
54
        ->end();
55
    }
56
    // @codeCoverageIgnoreEnd
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function load(ContainerBuilder $container, array $config)
62
    {
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 1
    public function process(ContainerBuilder $container)
69
    {
70 1
    }
71
}
72