LoadPermissionDataCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 7 1
A execute() 0 6 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Eziat\PermissionBundle\Command;
6
7
use Eziat\PermissionBundle\Loader\PermissionLoaderInterface;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
/**
13
 * @author Tomas Jakl <[email protected]>
14
 */
15
class LoadPermissionDataCommand extends Command
16
{
17
    /**
18
     * @var PermissionLoaderInterface
19
     */
20
    private $permissionLoader;
21
22
    public function __construct(PermissionLoaderInterface $permissionLoader)
23
    {
24
        $this->permissionLoader = $permissionLoader;
25
        parent::__construct();
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function configure()
32
    {
33
        $this
34
            ->setName('eziat:permission:load')
35
            ->setDescription('Loads a permission data from config files to the db.')
36
        ;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function execute(InputInterface $input, OutputInterface $output)
43
    {
44
        $this->permissionLoader->loadPermissions();
45
46
        $output->writeln('<info>Permissions were succesfully loaded.</info>');
47
    }
48
}