Completed
Push — master ( 4ad075...9b6fee )
by Vladimir
07:02
created

Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 0
loc 24
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 21 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Toolbelt;
6
7
use League\Container\Container;
8
use League\Flysystem\Adapter\Local;
9
use FondBot\Toolbelt\Commands\MakeIntent;
10
use League\Container\ReflectionContainer;
11
use Symfony\Component\Console\Application;
12
use FondBot\Toolbelt\Commands\MakeInteraction;
13
use FondBot\Filesystem\FilesystemServiceProvider;
14
15
class Factory
16
{
17
    public static function create(
18
        Container $container,
19
        string $basePath,
20
        string $resourcesPath
21
    ): Kernel {
22
        $container->delegate(new ReflectionContainer());
23
24
        $container->add('base_path', $basePath);
25
        $container->add('resources_path', $resourcesPath);
26
        $container->addServiceProvider(new FilesystemServiceProvider(new Local($basePath)));
27
28
        $kernel = new Kernel($container);
29
        $console = new Application('FondBot', \FondBot\Application\Kernel::VERSION);
30
        $console->add(new MakeIntent($kernel));
31
        $console->add(new MakeInteraction($kernel));
32
33
        $container->add(Kernel::class, $kernel);
34
        $container->add('console', $console);
35
36
        return $kernel;
37
    }
38
}
39