MonologHandlerOverridePass::process()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 1
nop 1
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 (RavenHandler::class === $definition->getClass()) {
20
                    $definition->setClass(Raven::class);
21
                }
22
            },
23
            $container->getDefinitions()
24
        );
25
    }
26
}
27