HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/desingelfysio.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;
	
	
	public function getFormHash($hash_prefix='')
	{
		return hash('sha256', $hash_prefix.$this->settings["hash_key"]);	
	}
	
	public function hasValidResponse($post_hash,$form_id)
	{	
		return $post_hash == $this->getFormHash($form_id) ? true : false;
	}

}