Completed
Push — master ( 527bb5...aca9c3 )
by César
05:15
created

Kernel::getContainer()   A

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 === static::$instance) {
0 ignored issues
show
Comprehensibility introduced by
Since Preetender\Routing\Kernel is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
24
            $container = new Container();
25
            $container->addServiceProvider(new RouteServiceProvider());
26
            static::$instance = $container;
0 ignored issues
show
Comprehensibility introduced by
Since Preetender\Routing\Kernel is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
27
        }
28
        return static::$instance;
0 ignored issues
show
Comprehensibility introduced by
Since Preetender\Routing\Kernel is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
29
    }
30
31
    /** @inheritdoc */
32
    private function __construct() {}
33
34
    /** @inheritdoc */
35
    private function __clone() {}
36
37
    /** @inheritdoc */
38
    private function __wakeup() {}
39
}