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

Factory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 17
ccs 0
cts 9
cp 0
c 0
b 0
f 0
cc 1
eloc 9
nop 2
crap 2
rs 9.4285
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