Passed
Push — master ( f94309...05219e )
by Oleg
04:40
created

KernelInjector::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php /** MicroKernelInjector */
2
3
namespace Micro\Base;
4
5
use Micro\Micro;
6
7
/**
8
 * Class KernelInjector
9
 *
10
 * @author Oleg Lunegov <[email protected]>
11
 * @link https://github.com/linpax/microphp-framework
12
 * @copyright Copyright &copy; 2013 Oleg Lunegov
13
 * @license /LICENSE
14
 * @package Micro
15
 * @subpackage Base
16
 * @version 1.0
17
 * @since 1.0
18
 */
19
class KernelInjector extends Injector
20
{
21
    /**
22
     * @access public
23
     * @return Micro
24
     * @throws Exception
25
     */
26
    public function build()
27
    {
28
        $kernel = $this->get('kernel');
29
30
        if (!($kernel instanceof Micro)) {
31
            throw new Exception('Component `kernel` not configured');
32
        }
33
34
        return $kernel;
35
    }
36
}