GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

LookupKeyCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Command\Storage;
6
7
use Damax\Bundle\ApiAuthBundle\Key\Storage\KeyNotFound;
8
use Damax\Bundle\ApiAuthBundle\Key\Storage\Reader as Storage;
9
use Symfony\Component\Console\Command\Command;
10
use Symfony\Component\Console\Input\InputArgument;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
use Symfony\Component\Console\Style\SymfonyStyle;
14
15
final class LookupKeyCommand extends Command
16
{
17
    protected static $defaultName = 'damax:api-auth:storage:lookup-key';
18
19
    private $storage;
20
21
    public function __construct(Storage $storage)
22
    {
23
        parent::__construct();
24
25
        $this->storage = $storage;
26
    }
27
28
    protected function configure()
29
    {
30
        $this
31
            ->setDescription('Lookup api key in storage.')
32
            ->addArgument('key', InputArgument::REQUIRED, 'Api key.')
33
        ;
34
    }
35
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $io = new SymfonyStyle($input, $output);
39
40
        try {
41
            $key = $this->storage->get($input->getArgument('key'));
42
        } catch (KeyNotFound $e) {
43
            $io->error('Key not found.');
44
45
            return 1;
46
        }
47
48
        $io->writeln('');
49
        $io->table([], [
50
            ['Key', (string) $key],
51
            ['Identity', $key->identity()],
52
            ['TTL', $key->ttl()],
53
        ]);
54
    }
55
}
56