Completed
Push — v2 ( 4c6274...a6d212 )
by Daniel
04:47
created

ImagineCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
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
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\DependencyInjection\CompilerPass;
15
16
use Silverback\ApiComponentBundle\File\FileUploader;
17
use Silverback\ApiComponentBundle\Imagine\PathResolver;
18
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
21
22
class ImagineCompilerPass implements CompilerPassInterface
23
{
24
    public function process(ContainerBuilder $container): void
25
    {
26
        try {
27
            $rootPaths = $container->getDefinition('liip_imagine.binary.loader.default')->getArgument(2)->getArgument(0);
28
29
            $container->getDefinition(PathResolver::class)
30
                ->setArgument('$roots', $rootPaths);
31
            $container->getDefinition(FileUploader::class)
32
                ->setArgument('$rootPaths', $rootPaths);
33
        } catch (ServiceNotFoundException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
34
        }
35
    }
36
}
37