GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ValidatorPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of the AL labs package
6
 *
7
 * (c) Arnaud Langlade
8
 * fsfgsd
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Al\ResourceManagement\Infrastructure\Framework;
14
15
use PhpCsFixer\Finder;
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19
final class ValidatorPass implements CompilerPassInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function process(ContainerBuilder $container)
25
    {
26
        $validationFiles = [];
27
        foreach (Finder::create()->files()->in($this->getRootDirectory())->name('*.yml') as $file) {
28
            $validationFiles[] = $file->getPathname();
29
        }
30
31
        sort($validationFiles);
32
33
        $container->getDefinition('validator.builder')->addMethodCall(
34
            'addYamlMappings',
35
            [$validationFiles]
36
        );
37
    }
38
39
    /**
40
     * @return string
41
     *
42
     * @throws \ReflectionException
43
     */
44
    private function getRootDirectory(): string
45
    {
46
        $bundleClass = new \ReflectionClass(AppBundle::class);
47
        $rootDirectory = sprintf(
48
            '%s/../../Application/Resources/validation',
49
            dirname($bundleClass->getFileName())
50
        );
51
52
        return $rootDirectory;
53
    }
54
}
55