Command::getContainer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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