Passed
Push — master ( bb58bc...1c054e )
by Théo
02:40 queued 01:10
created

ApplicationFactory::createParser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Console;
16
17
use Humbug\PhpScoper\Console\Command\AddPrefixCommand;
18
use Humbug\PhpScoper\Console\Command\InitCommand;
19
use Humbug\PhpScoper\Container;
20
use Humbug\PhpScoper\Scoper;
21
use Symfony\Component\Filesystem\Filesystem;
22
23
/**
24
 * @final
25
 * TODO: mark this class as final in the next release
26
 */
27
class ApplicationFactory
28
{
29
    public function create(): Application
30
    {
31
        $app = new Application(
32
            new Container(),
33
            'PHP Scoper'
34
        );
35
36
        $app->addCommands([
37
            new AddPrefixCommand(
38
                new Filesystem(),
39
                $app->getContainer()->getScoper()
40
            ),
41
            new InitCommand(),
42
        ]);
43
44
        return $app;
45
    }
46
47
    /**
48
     * @deprecated This function will be removed in the next release
49
     */
50
    protected static function createScoper(): Scoper
51
    {
52
        return (new Container())->getScoper();
53
    }
54
}
55