PublishGitHubCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Cpliakas\ManifestPublisher\Console;
4
5
use Cpliakas\ManifestPublisher\Manifest;
6
use Cpliakas\ManifestPublisher\Target as Target;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class PublishGitHubCommand extends Command
13
{
14
    protected function configure()
15
    {
16
        $this
17
            ->setName('publish:gh-pages')
18
            ->setDescription('Update and publish a manifest to GitHub Pages')
19
            ->addArgument(
20
                'package-name',
21
                InputArgument::REQUIRED,
22
                'The package name in vendor/project format'
23
            )
24
            ->addArgument(
25
                'target-package-name',
26
                InputArgument::OPTIONAL,
27
                'The target repo in vendor/project format'
28
            )
29
        ;
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $packageName = $input->getArgument('package-name');
38
        $targetPackageName = $input->getArgument('target-package-name');
39
40
        Manifest::factory($packageName, $targetPackageName)
41
            ->publish(new Target\GitHub());
42
    }
43
}
44