Kernel::getContainer()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace Preetender\Routing;
4
5
use League\Container\Container;
6
7
/**
8
 * Class Kernel
9
 * @package Preetender\Routing
10
 */
11
final class Kernel
12
{
13
    /** @var  Container */
14
    private static $instance;
15
16
    /**
17
     * Get container service
18
     *
19
     * @return Container
20
     */
21
    public static function getContainer(): Container
22
    {
23
        if( null === self::$instance) {
24
            $container = new Container();
25
            $container->addServiceProvider(new RouteServiceProvider());
26
            self::$instance = $container;
27
        }
28
        return self::$instance;
29
    }
30
}