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.

SecurityCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 12 1
B execute() 0 22 4
1
<?php
2
3
namespace Selim\Commands;
4
5
use Selim\SecurityChecker;
6
use Selim\SilverstripePage;
7
use Selim\Util;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class SecurityCommand extends SelimCommand{
13
    protected function configure()
14
    {
15
        parent::configure();
16
        $this
17
            ->setName('security')
18
            ->setDescription('check security of a site')
19
            ->addArgument(
20
                'name',
21
                InputArgument::REQUIRED,
22
                'Identifier for your Site'
23
            );
24
    }
25
26
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        $name = $input->getArgument('name');
29
        $cfg = $this->getSelimConfig($input);
30
31
        if ($cfg->siteExists($name)) {
32
            echo "Security-test for $name:".PHP_EOL;
33
            $site = $cfg->getSite($name);
34
            $sc = SecurityChecker::getInstance();
35
            $issues = $sc->findIssues(new SilverstripePage($site), true);
36
37
            if(count($issues)) {
38
                foreach ($issues as $iss) {
39
                    echo $iss;
40
                }
41
            }else{
42
                echo "No security issues found.";
43
            }
44
        } else {
45
            Util::reportError("Site with name '$name' doesn't exists!");
46
        }
47
    }
48
49
}