BaseCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A initialize() 0 11 1
1
<?php
2
3
namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Command;
4
5
use Doctrine\Persistence\ObjectManager;
6
use Symfony\Bridge\Doctrine\ManagerRegistry;
7
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\DependencyInjection\ContainerInterface;
11
12
class BaseCommand extends ContainerAwareCommand
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...d\ContainerAwareCommand has been deprecated with message: since Symfony 4.2, use {@see Command} instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
13
{
14
    /** @var ContainerInterface */
15
    protected $container;
16
    /** @var ObjectManager */
17
    protected $em;
18
19 9
    protected function configure(): void
20
    {
21 9
        parent::configure();
22
23
        $this
24 9
            ->setName('statuses:base')
25 9
            ->setDescription('Base command');
26 9
    }
27
28 9
    protected function initialize(InputInterface $input, OutputInterface $output): void
29
    {
30 9
        parent::initialize($input, $output); //initialize parent class method
31
32 9
        $this->container = $this->getContainer();
33
34
        // This loads Doctrine, you can load your own services as well
35
        /** @var ManagerRegistry $doctrine */
36 9
        $doctrine = $this->container->get('doctrine');
37 9
        $this->em = $doctrine->getManager();
38 9
    }
39
}
40