Passed
Push — feature/use-xml-service-defini... ( 918ff3...6d7c00 )
by Yo
02:28
created

LoggerSubExtension::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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