LocaleCompilerPass   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 1
1
<?php
2
3
namespace BrainExe\Core\DependencyInjection\CompilerPass;
4
5
use BrainExe\Core\Annotations\CompilerPass;
6
use BrainExe\Core\Util\Glob;
7
use Exception;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
11
/**
12
 * @CompilerPass
13
 */
14
class LocaleCompilerPass implements CompilerPassInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     *
19
     * @throws Exception
20
     */
21 2
    public function process(ContainerBuilder $container)
22
    {
23
        /** @var Glob $glob */
24 2
        $glob = $container->get(Glob::class);
25
26 2
        $locales = $glob->execGlob(ROOT . 'lang/*.po');
27 2
        $locales = array_map(function ($file) {
28 1
            return basename($file, '.po');
29 2
        }, $locales);
30
31 2
        $container->setParameter('locales', $locales);
32 2
    }
33
}
34