Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
GenerateRssFeed
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 handle
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 printFinishMessage
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Hyde\Framework\Actions\PostBuildTasks;
6
7use Hyde\Hyde;
8use Hyde\Framework\Features\BuildTasks\PostBuildTask;
9use Hyde\Framework\Concerns\InteractsWithDirectories;
10use Hyde\Framework\Features\XmlGenerators\RssFeedGenerator;
11
12use function file_put_contents;
13
14class GenerateRssFeed extends PostBuildTask
15{
16    use InteractsWithDirectories;
17
18    public static string $message = 'Generating RSS feed';
19
20    protected string $path;
21
22    public function handle(): void
23    {
24        $this->path = Hyde::sitePath(RssFeedGenerator::getFilename());
25
26        $this->needsParentDirectory($this->path);
27
28        file_put_contents($this->path, RssFeedGenerator::make());
29    }
30
31    public function printFinishMessage(): void
32    {
33        $this->createdSiteFile($this->path)->withExecutionTime();
34    }
35}