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.

ResetCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2015-07-31
7
 *
8
 */
9
10
namespace Chapi\Commands;
11
12
use Chapi\Component\Command\JobUtils;
13
use Chapi\Service\JobIndex\JobIndexServiceInterface;
14
15
class ResetCommand extends AbstractCommand
16
{
17
    /**
18
     * Configures the current command.
19
     */
20 2
    protected function configure()
21
    {
22 2
        $this->setName('reset')
23 2
            ->setDescription('Remove jobs from the index')
24
        ;
25
26 2
        JobUtils::configureJobNamesArgument($this, 'Jobs to remove from the index');
27 2
    }
28
29
    /**
30
     * @return int
31
     */
32 2
    protected function process()
33
    {
34 2
        $this->updateJobIndex(
35 2
            JobUtils::getJobNames($this->input, $this)
36
        );
37
38 2
        return 0;
39
    }
40
41
    /**
42
     * @param string[] $jobNames
43
     */
44 2
    private function updateJobIndex($jobNames)
45
    {
46
        /** @var JobIndexServiceInterface  $jobIndexService */
47 2
        $jobIndexService = $this->getContainer()->get(JobIndexServiceInterface::DIC_NAME);
48
49 2
        if (JobUtils::isWildcard($jobNames)) {
50 1
            $jobIndexService->resetJobIndex();
51
        } else {
52 1
            $jobIndexService->removeJobs($jobNames);
53
        }
54 2
    }
55
}
56