for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Hyde\Framework\Actions\PostBuildTasks;
use Hyde\Hyde;
use Hyde\Framework\Features\BuildTasks\PostBuildTask;
use Hyde\Framework\Concerns\InteractsWithDirectories;
use Hyde\Framework\Features\XmlGenerators\SitemapGenerator;
use function file_put_contents;
class GenerateSitemap extends PostBuildTask
{
use InteractsWithDirectories;
public static string $message = 'Generating sitemap';
protected string $path;
public function handle(): void
if (! Hyde::hasSiteUrl()) {
hasSiteUrl()
Hyde\Hyde
__callStatic
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
if (! Hyde::/** @scrutinizer ignore-call */ hasSiteUrl()) {
$this->skip('Cannot generate sitemap without a valid base URL');
}
$this->path = Hyde::sitePath('sitemap.xml');
sitePath()
/** @scrutinizer ignore-call */
$this->needsParentDirectory($this->path);
file_put_contents($this->path, SitemapGenerator::make());
public function printFinishMessage(): void
$this->createdSiteFile($this->path)->withExecutionTime();