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

SitemapGenerateCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

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