Completed
Push — master ( b69e83...ad913f )
by Vladimir
02:54
created

Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 0
cts 9
cp 0
c 0
b 0
f 0
rs 10
wmc 1
lcom 0
cbo 7

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 17 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Application;
6
7
use League\Container\Container;
8
use League\Container\ReflectionContainer;
9
use FondBot\Drivers\DriverServiceProvider;
10
use FondBot\Conversation\ContextServiceProvider;
11
12
class Factory
13
{
14
    public static function create(Container $container, string $routesPrefix = ''): Kernel
15
    {
16
        $container->delegate(new ReflectionContainer);
17
18
        // Load service providers
19
        $container->addServiceProvider(new LogServiceProvider);
20
        $container->addServiceProvider(new RouteServiceProvider($routesPrefix));
21
        $container->addServiceProvider(new DriverServiceProvider);
22
        $container->addServiceProvider(new ContextServiceProvider);
23
24
        // Boot kernel
25
        $kernel = new Kernel($container);
26
27
        $container->add(Kernel::class, $kernel);
28
29
        return $kernel;
30
    }
31
}
32