64 lines
1.5 KiB
PHP
64 lines
1.5 KiB
PHP
<?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(),
|
|
];
|
|
}
|
|
}
|