41 lines
717 B
PHP
41 lines
717 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Application\Controller;
|
|
|
|
use Application\Content\CockpitApi;
|
|
use Exception;
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
|
|
class HomeController extends MainController
|
|
{
|
|
|
|
/**
|
|
* @throws Exception
|
|
* @throws GuzzleException
|
|
*/
|
|
protected function action(): void
|
|
{
|
|
$this->pushToStash('articles', $this->getArticles());
|
|
}
|
|
|
|
/**
|
|
* @throws GuzzleException
|
|
*/
|
|
private function getArticles(): array
|
|
{
|
|
$return = [];
|
|
foreach ((new CockpitApi())->getArticles() as $article) {
|
|
$return[] = $article->getTeaserData();
|
|
}
|
|
|
|
return $return;
|
|
}
|
|
|
|
protected function getTemplate(): string
|
|
{
|
|
return '04_templates/t-home/t-home.twig';
|
|
}
|
|
}
|