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

LoggerSubExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 2
crap 2
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