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::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
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
}