Passed
Push — master ( 896e22...61bd56 )
by Dāvis
03:36
created

SitemapGenerateCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Sitemap\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class SitemapGenerateCommand extends ContainerAwareCommand
10
{
11
    protected function configure()
12
    {
13
        $this->setName('sludio:sitemap:generate')->setDescription('Regenerate sitemap');
14
    }
15
16
    protected function execute(InputInterface $input, OutputInterface $output)
17
    {
18
        $format = $this->getContainer()->getParameter('sludio_helper.sitemap.format');
19
        $type = $this->getContainer()->getParameter('sludio_helper.sitemap.type');
20
        $sitemap = $this->getContainer()->get("sludio_helper.sitemap.{$format}.{$type}");
21
22
        $output->writeln('Starting generation...');
23
        $sitemap->build();
24
        $output->writeln('Sitemap <info>generated!</info>');
25
    }
26
}