Implemented TemplateMeta and tests

This commit is contained in:
Kevin Frantz
2018-11-23 15:23:43 +01:00
parent 8a311caddc
commit b9a312cfd9
6 changed files with 124 additions and 16 deletions

View File

@@ -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;
}
}