Passed
Push — master ( 97dd58...4109cd )
by Dev
10:22
created

StaticCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PiedWeb\CMSBundle\StaticGenerator;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class StaticCommand extends Command
11
{
12
    private $staticAppGenerator;
13
14
    public function __construct(StaticAppGenerator $staticAppGenerator)
15
    {
16
        parent::__construct();
17
        $this->static = $staticAppGenerator;
0 ignored issues
show
Bug Best Practice introduced by
The property static does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
18
    }
19
20
    protected function configure()
21
    {
22
        $this
23
            ->setName('static:generate')
24
            ->setDescription('Generate static version  for your website')
25
            ->addArgument('host', InputArgument::OPTIONAL);
26
        ;
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31
        if ($input->getArgument('host')) {
32
            $this->staticAppGenerator->generateFromHost($input->getArgument('host'));
33
        } else
34
            $this->staticAppGenerator->generateAll();
35
36
        $output->writeln('Static version generation succeeded.');
37
    }
38
}
39