PublishGitHubCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 32
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 17 1
A execute() 0 8 1
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