Application   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 31
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A container() 0 3 1
A __construct() 0 4 1
A createApplication() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\RfcLinc\Application\Cli;
6
7
use PhpCfdi\RfcLinc\Application\Cli\Commands\CatalogCommand;
8
use PhpCfdi\RfcLinc\Application\Cli\Commands\UpdateCommand;
9
use PhpCfdi\RfcLinc\Application\SetUpContainerTrait;
10
use Pimple\Container;
11
use Symfony\Component\Console\Application as ConsoleApplication;
12
13
class Application extends ConsoleApplication
14
{
15
    use SetUpContainerTrait;
16
17
    /** @var Container */
18
    private $container;
19
20 5
    public function __construct(Container $container)
21
    {
22 5
        parent::__construct('rfclinc', '0.1.0');
23 5
        $this->container = $container;
24 5
    }
25
26 5
    public function container(): Container
27
    {
28 5
        return $this->container;
29
    }
30
31 5
    public static function createApplication(): self
32
    {
33
        // create
34 5
        $containter = new Container();
35 5
        $app = new static($containter);
36
37 5
        static::setUpContainer($containter);
38
39
        // pass container to avoid gateway creation
40 5
        $app->add(new UpdateCommand($containter));
41 5
        $app->add(new CatalogCommand($containter));
42
43 5
        return $app;
44
    }
45
}
46