🎉 initial commit
This commit is contained in:
63
classes/Application/Generator/Article.php
Normal file
63
classes/Application/Generator/Article.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Application\Generator;
|
||||
|
||||
class Article extends WebsiteObjectGenerator
|
||||
{
|
||||
public function __construct(protected readonly string $seed)
|
||||
{
|
||||
parent::__construct($seed);
|
||||
}
|
||||
|
||||
private function getHeadline(): string
|
||||
{
|
||||
return $this->getGenerator()->sentence(8);
|
||||
}
|
||||
|
||||
private function getKicker(): string
|
||||
{
|
||||
return $this->getGenerator()->word();
|
||||
}
|
||||
|
||||
private function getTeaserImage(): array
|
||||
{
|
||||
return (new Image($this->getSeed()))->getImage(640, 480);
|
||||
}
|
||||
|
||||
private function getHeroImage(): array
|
||||
{
|
||||
return (new Image($this->getSeed()))->getImage(1920, 1080);
|
||||
}
|
||||
|
||||
private function getExcerpt(): string
|
||||
{
|
||||
return implode(' ', $this->getGenerator()->sentences(5));
|
||||
}
|
||||
|
||||
private function getUrl(): string
|
||||
{
|
||||
return '/article/test-' . $this->getSeed();
|
||||
}
|
||||
|
||||
public function getTeaserData(): array
|
||||
{
|
||||
return [
|
||||
'headline' => $this->getHeadline(),
|
||||
'kicker' => $this->getKicker(),
|
||||
'excerpt' => $this->getExcerpt(),
|
||||
'teaserImage' => $this->getTeaserImage(),
|
||||
'url' => $this->getUrl(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getFullData(): array
|
||||
{
|
||||
return [
|
||||
'headline' => $this->getHeadline(),
|
||||
'kicker' => $this->getKicker(),
|
||||
'excerpt' => $this->getExcerpt(),
|
||||
'heroImage' => $this->getHeroImage(),
|
||||
'url' => $this->getUrl(),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user