SymfonyScoper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A scope() 0 3 1
A __construct() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the humbug/php-scoper package.
7
 *
8
 * Copyright (c) 2017 Théo FIDRY <[email protected]>,
9
 *                    Pádraic Brady <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Humbug\PhpScoper\Scoper;
16
17
use Humbug\PhpScoper\Scoper\Symfony\XmlScoper as SymfonyXmlScoper;
18
use Humbug\PhpScoper\Scoper\Symfony\YamlScoper as SymfonyYamlScoper;
19
use Humbug\PhpScoper\Symbol\EnrichedReflector;
20
use Humbug\PhpScoper\Symbol\SymbolsRegistry;
21
use PhpParser\Error as PhpParserError;
22
use function func_get_args;
23
24
/**
25
 * Scopes the Symfony configuration related files.
26
 */
27
final class SymfonyScoper implements Scoper
28
{
29
    private SymfonyXmlScoper $decoratedScoper;
30
31
    public function __construct(
32
        Scoper $decoratedScoper,
33
        string $prefix,
34
        EnrichedReflector $enrichedReflector,
35
        SymbolsRegistry $symbolsRegistry
36
    ) {
37
        $this->decoratedScoper = new SymfonyXmlScoper(
38
            new SymfonyYamlScoper(
39
                $decoratedScoper,
40
                $prefix,
41
                $enrichedReflector,
42
                $symbolsRegistry,
43
            ),
44
            $prefix,
45
            $enrichedReflector,
46
            $symbolsRegistry,
47
        );
48
    }
49
50
    /**
51
     * Scopes PHP files.
52
     *
53
     * @throws PhpParserError
54
     */
55
    public function scope(string $filePath, string $contents): string
56
    {
57
        return $this->decoratedScoper->scope(...func_get_args());
58
    }
59
}
60