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

StaticCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

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