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   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 41
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A process() 0 8 1
A updateJobIndex() 0 11 2
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