File: /var/www/vhosts/creativefellows.nl/firstbrick.creativefellows.nl/src/Action/TwigAction.php
<?php
namespace App\Action;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
//use Psr\Container\ContainerInterface;
use Slim\Exception\HttpBadRequestException;
use Slim\Exception\HttpNotFoundException;
use Slim\Views\Twig;
use App\Domain\Page\Service\PageReader;
use App\Domain\Navigation\Service\NavigationReader;
use App\Domain\Language\LanguageData;
abstract class TwigAction
{
private $twig;
public function __construct(
Twig $twig,
PageReader $pageReader,
NavigationReader $navigationReader,
LanguageData $language
){
$this->twig = $twig;
$this->pageReader = $pageReader;
$this->navigationReader = $navigationReader;
$this->language = $language;
}
/**
* @param Request $request
* @param Response $response
* @param array $args
* @return Response
* @throws HttpNotFoundException
* @throws HttpBadRequestException
*/
public function __invoke(Request $request, Response $response, $args): Response
{
$this->request = $request;
$this->response = $response;
$this->args = $args;
return $this->action();
}
/**
* @return Response
* @throws DomainRecordNotFoundException
* @throws HttpBadRequestException
*/
abstract protected function action(): Response;
}