ContainerAwareCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainer() 0 8 2
A setContainer() 0 4 1
1
<?php
2
/**
3
 * This file is part of LuisMulinari\Consoleful
4
 *
5
 * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
6
 */
7
8
namespace LuisMulinari\Consoleful\Command;
9
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
12
use Symfony\Component\DependencyInjection\ContainerInterface;
13
14
abstract class ContainerAwareCommand extends Command implements ContainerAwareInterface
15
{
16
    /**
17
     * @var ContainerInterface|null
18
     */
19
    private $container;
20
21
    /**
22
     * @return ContainerInterface
23
     */
24 2
    public function getContainer()
25
    {
26 2
        if (null === $this->container) {
27 1
            throw new \LogicException('The container cannot be retrieved');
28
        }
29
30 1
        return $this->container;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function setContainer(ContainerInterface $container = null)
37
    {
38 1
        $this->container = $container;
39 1
    }
40
}
41