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.

FixCronCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 16 1
A doExecute() 0 15 4
1
<?php
2
namespace Kunstmaan\Skylab\Command;
3
4
use Kunstmaan\Skylab\Skeleton\AnacronSkeleton;
5
use Symfony\Component\Console\Input\InputArgument;
6
7
/**
8
 * FixCronCommand
9
 */
10
class FixCronCommand extends AbstractCommand
11
{
12
13
    /**
14
     * Configures the current command.
15
     */
16
    protected function configure()
17
    {
18
        $this
19
            ->addDefaults()
20
            ->setName('cron')
21
            ->setDescription('Installs the cronjob on all or one Skylab projects')
22
            ->addArgument('project', InputArgument::OPTIONAL, 'If set, the task will only set the cron for the project named')
23
            ->setHelp(<<<EOT
24
The <info>cron</info> command will setup the cronjobs for one or all projects.
25
26
<info>php skylab.phar cron</info>                         # Will setup the cron for all projects
27
<info>php skylab.phar cron myproject</info>               # Will setup the cron the myproject project
28
29
EOT
30
            );
31
    }
32
33
    protected function doExecute()
34
    {
35
        $onlyprojectname = $this->input->getArgument('project');
36
        /** @var AnacronSkeleton $theSkeleton */
37
        $theSkeleton = $this->skeletonProvider->findSkeleton(AnacronSkeleton::NAME);
38
        $this->fileSystemProvider->projectsLoop(function ($project) use ($onlyprojectname, $theSkeleton) {
39
            if (isset($onlyprojectname) && $project["name"] != $onlyprojectname) {
40
                return;
41
            }
42
            if ($this->skeletonProvider->hasSkeleton($project, $theSkeleton)) {
43
                $this->dialogProvider->logStep("Running cron on project " . $project["name"]);
44
                $theSkeleton->maintenance($project);
45
            }
46
        });
47
    }
48
}
49