RemoveKeyCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 5 1
A __construct() 0 5 1
A configure() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Command\Storage;
6
7
use Damax\Bundle\ApiAuthBundle\Key\Storage\Writer as Storage;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
use Symfony\Component\Console\Style\SymfonyStyle;
13
14
final class RemoveKeyCommand extends Command
15
{
16
    protected static $defaultName = 'damax:api-auth:storage:remove-key';
17
18
    private $storage;
19
20
    public function __construct(Storage $storage)
21
    {
22
        parent::__construct();
23
24
        $this->storage = $storage;
25
    }
26
27
    protected function configure()
28
    {
29
        $this
30
            ->setDescription('Remove api key from storage.')
31
            ->addArgument('key', InputArgument::REQUIRED, 'Api key.')
32
        ;
33
    }
34
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $this->storage->remove((string) $input->getArgument('key'));
38
39
        (new SymfonyStyle($input, $output))->success('Done');
40
    }
41
}
42