Optimized for SPA

This commit is contained in:
Kevin Frantz
2019-01-05 23:52:37 +01:00
parent 9e685260e9
commit bccd6efaff
393 changed files with 253 additions and 37 deletions

View File

@@ -0,0 +1,97 @@
<?php
namespace App\Domain\TemplateManagement;
use App\DBAL\Types\RESTResponseType;
/**
* @author kevinfrantz
*/
final class TemplateMeta implements TemplateMetaInterface
{
/**
* @var array
*/
private $basicPathArray;
/**
* @var string
*/
private $basicName;
/**
* @var string
*/
private $type = RESTResponseType::HTML;
/**
* @var string
*/
private $pathSuffix;
/**
* @var string
*/
private $frameTemplatePath;
/**
* @var string
*/
private $contentTemplatePath;
/**
* @var string
*/
private $folder;
public function __construct(array $basicPathArray, string $basicName, string $folder)
{
$this->basicPathArray = $basicPathArray;
$this->basicName = $basicName;
$this->folder = $folder;
$this->init();
}
private function init()
{
$this->setPathSuffix();
$this->setFrameTemplatePath();
$this->setContentTemplatePath();
}
private function setPathSuffix(): void
{
$this->pathSuffix = $this->folder.'/'.implode('/', $this->basicPathArray).'/'.$this->basicName.'.'.$this->type.'.twig';
}
private function setFrameTemplatePath(): void
{
$this->frameTemplatePath = 'frame/'.$this->pathSuffix;
}
private function setContentTemplatePath(): void
{
$this->contentTemplatePath = 'content/'.$this->pathSuffix;
}
public function getFrameTemplatePath(): string
{
return $this->frameTemplatePath;
}
public function getContentTemplatePath(): string
{
return $this->contentTemplatePath;
}
public function setTemplateType(string $type): void
{
$this->type = $type;
$this->init();
}
public function getTemplateType(): string
{
return $this->type;
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Domain\TemplateManagement;
/**
* Manages all informations which are needed to process templates.
*
* @deprecated
*
* @author kevinfrantz
*/
interface TemplateMetaInterface
{
/**
* Sets the template type which should be processed(General html);.
*/
public function setTemplateType(string $type): void;
public function getTemplateType(): string;
/**
* Returns a template inclusiv frame.
*
* @return string
*/
public function getFrameTemplatePath(): string;
/**
* Returns a template without a frame.
*
* @return string
*/
public function getContentTemplatePath(): string;
}