Completed
Push — master ( 5bd517...c7b86e )
by Tomáš
08:52
created

SculpinCompilerExtension::expandParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Symplify
7
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
8
 */
9
10
namespace Symplify\PHP7_Sculpin\DI;
11
12
use Nette\DI\Compiler;
13
use Nette\DI\CompilerExtension;
14
use Symfony\Component\Console\Command\Command;
15
use Symplify\PHP7_Sculpin\Console\ConsoleApplication;
16
use Symplify\PHP7_Sculpin\Contract\Renderable\Routing\Route\RouteInterface;
17
use Symplify\PHP7_Sculpin\Contract\Source\SourceFileFilter\SourceFileFilterInterface;
18
use Symplify\PHP7_Sculpin\DI\Helper\TypeAndCollectorTrait;
19
use Symplify\PHP7_Sculpin\Renderable\Routing\RouteDecorator;
20
use Symplify\PHP7_Sculpin\Source\SourceFileStorage;
21
22
final class SculpinCompilerExtension extends CompilerExtension
23
{
24
    use TypeAndCollectorTrait;
25
26
    public function loadConfiguration()
27
    {
28
        $this->loadServicesFromConfig();
29
    }
30
31
    public function beforeCompile()
32
    {
33 7
        $this->collectByType(ConsoleApplication::class, Command::class, 'add');
34
        $this->collectByType(SourceFileStorage::class, SourceFileFilterInterface::class, 'addSourceFileFilter');
35 7
        $this->collectByType(RouteDecorator::class, RouteInterface::class, 'addRoute');
36 7
    }
37 7
38 7
    private function loadServicesFromConfig()
39
    {
40 6
        Compiler::loadDefinitions(
41
            $this->getContainerBuilder(),
42 6
            $this->loadFromFile(__DIR__ . '/../config/services.neon')['services']
43 6
        );
44 6
    }
45
}
46