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.

DecodeCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 6
dl 0
loc 53
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 12 1
A execute() 0 15 2
A createTable() 0 4 1
A setTableLayout() 0 4 1
1
<?php
2
/**
3
 * This file is part of the ramsey/uuid-console application
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright Copyright (c) Ben Ramsey <[email protected]>
9
 * @license http://opensource.org/licenses/MIT MIT
10
 * @link https://packagist.org/packages/ramsey/uuid-console Packagist
11
 * @link https://github.com/ramsey/uuid-console GitHub
12
 */
13
14
namespace Ramsey\Uuid\Console\Command;
15
16
use Symfony\Component\Console\Command\Command;
17
use Symfony\Component\Console\Input\InputArgument;
18
use Symfony\Component\Console\Input\InputInterface;
19
use Symfony\Component\Console\Output\OutputInterface;
20
use Ramsey\Uuid\Console\Exception;
21
use Ramsey\Uuid\Uuid;
22
use Ramsey\Uuid\Console\Util\UuidFormatter;
23
use Symfony\Component\Console\Helper\Table;
24
25
/**
26
 * Provides the console command to decode UUIDs and dump information about them
27
 */
28
class DecodeCommand extends Command
29
{
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        parent::configure();
36
37
        $this->setName('decode')
38
            ->setDescription('Decode a UUID and dump information about it')
39
            ->addArgument(
40
                'uuid',
41
                InputArgument::REQUIRED,
42
                'The UUID to decode.'
43
            );
44
    }
45
46
    /**
47
     * {@inheritDoc}
48
     *
49
     * @param InputInterface $input
50
     * @param OutputInterface $output
51
     */
52
    protected function execute(InputInterface $input, OutputInterface $output)
53
    {
54
        if (!Uuid::isValid($input->getArgument('uuid'))) {
55
            throw new Exception('Invalid UUID (' . $input->getArgument('uuid') . ')');
56
        }
57
58
        $uuid = Uuid::fromString($input->getArgument('uuid'));
59
60
        $table = $this->createTable($output);
61
        $this->setTableLayout($table);
62
63
        (new UuidFormatter())->write($table, $uuid);
64
65
        $table->render($output);
66
    }
67
68
    protected function createTable(OutputInterface $output)
69
    {
70
        return new Table($output);
71
    }
72
73
    /**
74
     * @param object $table
75
     */
76
    protected function setTableLayout($table)
77
    {
78
        $table->setStyle('borderless');
79
    }
80
}
81