Completed
Push — master ( 99cd39...7d74f8 )
by VEBER
02:07
created

Command   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
c 4
b 0
f 0
lcom 0
cbo 3
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getKernel() 0 9 2
A getContainer() 0 4 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
16
/**
17
 *
18
 */
19
abstract class Command extends BaseCommand
20
{
21
    /**
22
     * Get kernel.
23
     *
24
     * @return \Symfony\Component\HttpKernel\KernelInterface
25
     *
26
     * @throws \RuntimeException
27
     *
28
     * @codeCoverageIgnore
29
     */
30
    protected function getKernel()
31
    {
32
        $application = $this->getApplication();
33
        if (!$application instanceof \CLIFramework\Application) {
34
            throw new \RuntimeException('Application should be an instance of \CLIFramework\Application');
35
        }
36
37
        return $application->getKernel();
38
    }
39
40
    /**
41
     * Get Container.
42
     *
43
     * @return \Symfony\Component\DependencyInjection\ContainerInterface
44
     *
45
     * @codeCoverageIgnore
46
     */
47
    protected function getContainer()
48
    {
49
        return $this->getKernel()->getContainer();
50
    }
51
}
52