GenerateSitemap::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chinstrap\Core\Console\Commands;
6
7
use Chinstrap\Core\Contracts\Generators\Sitemap;
8
use League\Flysystem\FilesystemInterface;
9
use Symfony\Component\Console\Command\Command;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
final class GenerateSitemap extends Command
14
{
15
    protected Sitemap $sitemap;
16
17
    protected FilesystemInterface $manager;
18
19
    public function __construct(Sitemap $sitemap, FilesystemInterface $manager)
20
    {
21
        parent::__construct();
22
        $this->sitemap = $sitemap;
23
        $this->manager = $manager;
24
    }
25
26
    protected function configure(): void
27
    {
28
        $this->setName('sitemap:generate')
29
                ->setDescription('Generates the sitemap')
30
                ->setHelp('This command will generate the sitemap');
31
    }
32
33
    protected function execute(InputInterface $input, OutputInterface $output): int
34
    {
35
        $this->manager->put('assets://sitemap.xml', $this->sitemap->__invoke());
36
        return 1;
37
    }
38
}
39