Export   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 3
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A configure() 0 12 1
A execute() 0 7 1
1
<?php
2
3
/**
4
 * This file is part of the Setup package.
5
 *
6
 * (c) Sitewards GmbH
7
 */
8
9
namespace Sitewards\Setup\Command\Page;
10
11
use Sitewards\Setup\Service\Page\ExporterInterface;
12
use Symfony\Component\Console\Command\Command;
13
use Symfony\Component\Console\Input\InputArgument;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
final class Export extends Command
18
{
19
    /** @var ExporterInterface */
20
    private $exporter;
21
22
    /**
23
     * @param ExporterInterface $exporter
24
     */
25
    public function __construct(ExporterInterface $exporter)
26
    {
27
        parent::__construct();
28
29
        $this->exporter = $exporter;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function configure()
36
    {
37
        $this
38
            ->setName('page:export')
39
            ->setDescription('Export page(s) to JSON format')
40
            ->addArgument(
41
                'identifier',
42
                InputArgument::IS_ARRAY,
43
                'Which page identifier would you like to export?',
44
                null
45
            );
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    protected function execute(InputInterface $input, OutputInterface $output)
52
    {
53
        $identifier = $input->getArgument('identifier');
54
55
        $this->exporter->setIdentifier($identifier);
56
        $this->exporter->execute();
57
    }
58
}
59