Passed
Pull Request — master (#12)
by
unknown
12:02
created

GenerateSitemapCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenDesloovere\SitemapBundle\Console;
4
5
use JeroenDesloovere\SitemapBundle\Generator\SitemapGenerator;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * Build sitemap
12
 * Example: "bin/console sitemap:generate"
13
 */
14
class GenerateSitemapCommand extends Command
15
{
16
    private $sitemapGenerator;
17
18
    public function __construct(SitemapGenerator $sitemapGenerator)
19
    {
20
        $this->sitemapGenerator = $sitemapGenerator;
21
        parent::__construct('sitemap:generate');
22
    }
23
24
    protected function configure(): void
25
    {
26
        $this->setDescription('Generate the sitemapindex and all the sitemaps');
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output): void
30
    {
31
        $this->sitemapGenerator->generate();
32
    }
33
}
34