Passed
Pull Request — master (#492)
by Théo
01:52
created

ScoperFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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;
16
17
use Humbug\PhpScoper\PhpParser\TraverserFactory;
18
use Humbug\PhpScoper\Scoper\Composer\InstalledPackagesScoper;
19
use Humbug\PhpScoper\Scoper\Composer\JsonFileScoper;
20
use Humbug\PhpScoper\Scoper\NullScoper;
21
use Humbug\PhpScoper\Scoper\PatchScoper;
22
use Humbug\PhpScoper\Scoper\PhpScoper;
23
use Humbug\PhpScoper\Scoper\SymfonyScoper;
24
use PhpParser\Parser;
25
26
/**
27
 * @final
28
 */
29
class ScoperFactory
30
{
31
    private Parser $parser;
32
33
    public function __construct(Parser $parser)
34
    {
35
        $this->parser = $parser;
36
    }
37
38
    public function createScoper(/* Configuration $configuration */): Scoper
39
    {
40
        return new PatchScoper(
41
            new PhpScoper(
42
                $this->parser,
43
                new JsonFileScoper(
44
                    new InstalledPackagesScoper(
45
                        new SymfonyScoper(
46
                            new NullScoper()
47
                        )
48
                    )
49
                ),
50
                new TraverserFactory(new Reflector(/* Configuration $configuration */))
51
            )
52
        );
53
    }
54
}
55