Command::getKernel()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 9
ccs 0
cts 0
cp 0
rs 9.6667
cc 2
eloc 5
nc 2
nop 0
crap 6
1
<?php
2
3
/**
4
 * This file is part of the CLIFramework package.
5
 *
6
 * (c) Arnaud VEBER <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CLIFramework;
13
14
use Symfony\Component\Console\Command\Command as BaseCommand;
15
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
16
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
17
18
/**
19
 *
20
 */
21
class Command extends BaseCommand implements ContainerAwareInterface
22
{
23
    use ContainerAwareTrait;
24
25
    /**
26
     * Get kernel.
27
     *
28
     * @return \Symfony\Component\HttpKernel\KernelInterface
29
     *
30
     * @throws \RuntimeException
31
     *
32
     * @codeCoverageIgnore
33
     */
34
    protected function getKernel()
35
    {
36
        $application = $this->getApplication();
37
        if (!$application instanceof \CLIFramework\Application) {
38
            throw new \RuntimeException('Application should be an instance of \CLIFramework\Application');
39
        }
40
41
        return $application->getKernel();
42
    }
43
44
    /**
45
     * Get Container.
46
     *
47
     * @return \Symfony\Component\DependencyInjection\ContainerInterface
48
     */
49 1
    protected function getContainer()
50
    {
51 1
        return $this->container;
52
    }
53
}
54