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.

MaintenanceCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 8
dl 0
loc 58
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 16 1
B doExecute() 0 31 2
1
<?php
2
namespace Kunstmaan\Skylab\Command;
3
4
use Kunstmaan\Skylab\Skeleton\AbstractSkeleton;
5
use Kunstmaan\Skylab\Skeleton\BaseSkeleton;
6
use Symfony\Component\Console\Input\InputOption;
7
8
/**
9
 * MaintenanceCommand
10
 */
11
class MaintenanceCommand extends AbstractCommand
12
{
13
14
    /**
15
     * Configures the current command.
16
     */
17
    protected function configure()
18
    {
19
        $this
20
            ->addDefaults()
21
            ->setName('maintenance')
22
            ->setDescription('Run maintenance on all Skylab projects')
23
            ->addOption("--quick", null, InputOption::VALUE_NONE, 'If set, no fixperms will be executed')
24
            ->setHelp(<<<EOT
25
The <info>maintenance</info> command will run the maintenance commands of all skeletons on a project. Most notably, it
26
will create the apache config files and make sure the the databases are available.
27
28
<info>php skylab.phar maintenance</info>
29
30
EOT
31
            );
32
    }
33
34
    /**
35
     *
36
     */
37
    protected function doExecute()
38
    {
39
        $this->dialogProvider->logStep("Running preMaintenance");
40
        $this->skeletonProvider->skeletonLoop(function (AbstractSkeleton $theSkeleton) {
41
            $this->dialogProvider->logTask("Running preMaintenance for skeleton " . $theSkeleton->getName());
42
            $theSkeleton->preMaintenance();
43
        });
44
45
        $this->fileSystemProvider->projectsLoop(function ($project) {
46
            $this->dialogProvider->logStep("Running maintenance on " . $project["name"]);
47
            $this->skeletonProvider->skeletonLoop(function (AbstractSkeleton $theSkeleton) use ($project) {
48
                $this->dialogProvider->logTask("Running maintenance for skeleton " . $theSkeleton->getName());
49
                $theSkeleton->maintenance($project);
50
            }, new \ArrayObject($project["skeletons"]));
51
        });
52
53
        $this->dialogProvider->logStep("Running postMaintenance");
54
        $this->skeletonProvider->skeletonLoop(function (AbstractSkeleton $theSkeleton) {
55
            $this->dialogProvider->logTask("Running postMaintenance for skeleton " . $theSkeleton->getName());
56
            $theSkeleton->postMaintenance();
57
        });
58
59
        if (!$this->input->getOption('quick')) {
60
            $this->fileSystemProvider->projectsLoop(function ($project) {
61
                $this->dialogProvider->logStep("Running fixperms on " . $project["name"]);
62
                /** @var BaseSkeleton $abstractSkeleton */
63
                $abstractSkeleton = $this->skeletonProvider->findSkeleton('base');
64
                $abstractSkeleton->setPermissions(new \ArrayObject($project));
65
            });
66
        }
67
    }
68
}
69