Passed
Push — master ( 1afa4d...c3dc3d )
by Caen
02:58 queued 13s
created

GenerateRssFeed::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Hyde\Framework\Actions\PostBuildTasks;
4
5
use Hyde\Framework\Contracts\AbstractBuildTask;
6
use Hyde\Framework\Hyde;
7
use Hyde\Framework\Services\RssFeedService;
8
9
class GenerateRssFeed extends AbstractBuildTask
10
{
11
    public static string $description = 'Generating RSS feed';
12
13
    public function run(): void
14
    {
15
        file_put_contents(
16
            Hyde::getSiteOutputPath(RssFeedService::getDefaultOutputFilename()),
17
            RssFeedService::generateFeed()
18
        );
19
    }
20
21
    public function then(): void
22
    {
23
        $this->writeln(sprintf("\n > Created <info>%s</info> in %s",
24
            RssFeedService::getDefaultOutputFilename(),
25
            $this->getExecutionTime()
26
        ));
27
    }
28
}
29