SuggestMissingExtensionPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 10
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
3
/*
4
 * This file is part of ocubom/twig-extra-bundle
5
 *
6
 * © Oscar Cubo Medina <https://ocubom.github.io>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ocubom\TwigExtraBundle\DependencyInjection\Compiler;
13
14
use Ocubom\TwigExtraBundle\Extensions;
15
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
18
class SuggestMissingExtensionPass implements CompilerPassInterface
19
{
20
    public function process(ContainerBuilder $container): void
21
    {
22
        if ($container->getParameter('kernel.debug')) {
23
            $container->getDefinition('twig')
24
                ->addMethodCall(
25
                    'registerUndefinedFilterCallback',
26
                    [[Extensions::class, 'suggestFilter']]
27
                )
28
                ->addMethodCall(
29
                    'registerUndefinedFunctionCallback',
30
                    [[Extensions::class, 'suggestFunction']]
31
                )
32
            ;
33
        }
34
    }
35
}
36