Completed
Branch master (a89fae)
by Michał
03:16
created

MonologHandlerOverridePass::process()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 1
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dziki\MonologSentryBundle\DependencyInjection\Compiler;
6
7
use Dziki\MonologSentryBundle\Handler\Raven;
8
use Monolog\Handler\RavenHandler;
9
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use Symfony\Component\DependencyInjection\Definition;
12
13
class MonologHandlerOverridePass implements CompilerPassInterface
14
{
15
    public function process(ContainerBuilder $container): void
16
    {
17
        array_map(
18
            function (Definition $definition) {
19
                if ($definition->getClass() === RavenHandler::class) {
20
                    $definition->setClass(Raven::class);
21
                }
22
            },
23
            $container->getDefinitions()
24
        );
25
    }
26
}
27