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.

RemoveSiteCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 12 1
A execute() 0 13 2
1
<?php
2
3
namespace Selim\Commands;
4
5
use Selim\Util;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class RemoveSiteCommand extends SelimCommand{
11
    protected function configure()
12
    {
13
        parent::configure();
14
        $this
15
            ->setName('rm')
16
            ->setDescription('Remove a Site')
17
            ->addArgument(
18
                'name',
19
                InputArgument::REQUIRED,
20
                'Identifier for your Site'
21
            );
22
    }
23
24
    protected function execute(InputInterface $input, OutputInterface $output)
25
    {
26
        $name = $input->getArgument('name');
27
        $cfg = $this->getSelimConfig($input);
28
29
        if ($cfg->siteExists($name)) {
30
            $cfg->removeSite($name);
31
            $cfg->write();
32
            echo "removed: '$name'".PHP_EOL;
33
        } else {
34
            Util::reportError("Site with name '$name' doesn't exists!");
35
        }
36
    }
37
}