mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented TemplateMeta and tests
This commit is contained in:
@@ -2,14 +2,16 @@
|
||||
|
||||
namespace App\Domain\TemplateManagement;
|
||||
|
||||
use App\Domain\FormManagement\FormMetaInterface;
|
||||
use App\Domain\SourceManagement\SourceMetaInterface;
|
||||
use App\DBAL\Types\TemplateType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class TemplateMeta implements TemplateMetaInterface
|
||||
{
|
||||
/**
|
||||
* @var TemplateMetaInterface
|
||||
* @var SourceMetaInterface
|
||||
*/
|
||||
private $sourceMeta;
|
||||
|
||||
@@ -18,24 +20,67 @@ class TemplateMeta implements TemplateMetaInterface
|
||||
*/
|
||||
private $type = TemplateType::HTML;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $pathSuffix;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $frameTemplatePath;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $contentTemplatePath;
|
||||
|
||||
public function __construct(SourceMetaInterface $sourceMeta)
|
||||
{
|
||||
$this->sourceMeta = $sourceMeta;
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function getFramedTemplatePath(): string
|
||||
private function init()
|
||||
{
|
||||
$this->setPathSuffix();
|
||||
$this->setFrameTemplatePath();
|
||||
$this->setContentTemplatePath();
|
||||
}
|
||||
|
||||
public function getFramelessTemplatePath(): string
|
||||
private function setPathSuffix(): void
|
||||
{
|
||||
$this->pathSuffix = implode('/', $this->sourceMeta->getBasicPathArray()).'/'.$this->sourceMeta->getBasicName().'.'.$this->type.'.twig';
|
||||
}
|
||||
|
||||
public function getFormMeta(): FormMetaInterface
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user