Completed
Push — master ( 4bd921...074db3 )
by Vladimir
15:25 queued 08:35
created

Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 11

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 11

1 Method

Rating   Name   Duplication   Size   Complexity  
B create() 0 24 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Toolbelt;
6
7
use FondBot\Application\Kernel;
8
use League\Container\Container;
9
use League\Container\ReflectionContainer;
10
use Symfony\Component\Console\Application;
11
12
class Factory
13
{
14 1
    public static function create(Container $container): Kernel
15
    {
16 1
        $container->delegate(new ReflectionContainer);
17
18
        // Boot kernel
19 1
        $kernel = Kernel::createInstance($container);
20
21
        // Boot console application
22 1
        $console = new Application('FondBot', Kernel::VERSION);
23 1
        $console->addCommands([
24 1
            new Commands\MakeIntent($kernel),
25 1
            new Commands\MakeInteraction($kernel),
26 1
            new Commands\ListDrivers($kernel),
27 1
            new Commands\InstallDriver($kernel),
28 1
            new Commands\ListChannels($kernel),
29 1
            new Commands\Log($kernel),
30 1
            new Commands\QueueWorker($kernel),
31
        ]);
32
33 1
        $container->add(Kernel::class, $kernel);
34 1
        $container->add('console', $console);
35
36 1
        return $kernel;
37
    }
38
}
39