ContainerAwareCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 31
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainer() 0 8 2
A setContainer() 0 4 1
1
<?php
2
/**
3
 * @author Jean Silva <[email protected]>
4
 * @license MIT
5
 */
6
namespace Jeancsil\FlightSpy\Command;
7
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
10
use Symfony\Component\DependencyInjection\ContainerInterface;
11
12
class ContainerAwareCommand extends Command implements ContainerAwareInterface
13
{
14
    /**
15
     * @var ContainerInterface|null
16
     */
17
    private $container;
18
19
    /**
20
     * @return ContainerInterface
21
     *
22
     * @throws \LogicException
23
     */
24
    protected function getContainer()
25
    {
26
        if (null === $this->container) {
27
            throw new \LogicException('The container cannot be retrieved as the application instance is not yet set.');
28
        }
29
30
        return $this->container;
31
    }
32
33
    /**
34
     * Sets the container.
35
     *
36
     * @param ContainerInterface|null $container A ContainerInterface instance or null
37
     */
38
    public function setContainer(ContainerInterface $container = null)
39
    {
40
        $this->container = $container;
41
    }
42
}
43