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.

BackupCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
namespace Kunstmaan\Skylab\Command;
3
4
use Kunstmaan\Skylab\Skeleton\AbstractSkeleton;
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputOption;
7
8
/**
9
 * BackupCommand
10
 */
11
class BackupCommand extends AbstractCommand
12
{
13
14
    /**
15
     * Configures the current command.
16
     */
17
    protected function configure()
18
    {
19
        $this
20
            ->addDefaults()
21
            ->setName('backup')
22
            ->setDescription('Run backup on all or one Skylab projects')
23
            ->addArgument('project', InputArgument::OPTIONAL, 'If set, the task will only backup the project named')
24
            ->addOption("--quick", null, InputOption::VALUE_NONE, 'If set, no tar.gz file will be created, only the preBackup and postBackup hooks will be executed.')
25
            ->setHelp(<<<EOT
26
The <info>backup</info> command will dump all your databases and create a tarball of one or all projects.
27
28
<info>php skylab.phar backup</info>                         # Will backup all projects
29
<info>php skylab.phar backup myproject</info>               # Will backup the myproject project
30
<info>php skylab.phar backup myproject --quick</info>       # Will backup the myproject project, but not create the tar file.
31
32
EOT
33
            );
34
    }
35
36
    protected function doExecute()
37
    {
38
        $onlyprojectname = $this->input->getArgument('project');
39
        $this->fileSystemProvider->projectsLoop(function ($project) use ($onlyprojectname) {
40
            if (isset($onlyprojectname) && $project["name"] != $onlyprojectname) {
41
                return;
42
            }
43
            $this->dialogProvider->logStep("Running backup on project " . $project["name"]);
44
            $this->skeletonProvider->skeletonLoop(function (AbstractSkeleton $theSkeleton) use ($project) {
45
                $this->dialogProvider->logTask("Running preBackup for skeleton " . $theSkeleton->getName());
46
                $theSkeleton->preBackup($project);
47
            }, new \ArrayObject($project["skeletons"]));
48
            if (!$this->input->getOption('quick')) {
49
                $this->dialogProvider->logTask("Tarring the project folder");
50
                $this->fileSystemProvider->runTar($project);
51
            }
52
            $this->skeletonProvider->skeletonLoop(function (AbstractSkeleton $theSkeleton) use ($project) {
53
                $this->dialogProvider->logTask("Running postBackup for skeleton " . $theSkeleton->getName());
54
                $theSkeleton->postBackup($project);
55
            }, new \ArrayObject($project["skeletons"]));
56
        });
57
    }
58
}
59