Optimized draft for meta and template informations

This commit is contained in:
Kevin Frantz
2019-01-06 11:32:05 +01:00
parent 77cd11233d
commit 73a8d5f133
17 changed files with 601 additions and 372 deletions

View File

@@ -0,0 +1,88 @@
<?php
namespace src\Domain\TemplateManagement;
use App\Domain\TemplateManagement\TemplatePathFormAndViewInterface;
use App\Domain\TemplateManagement\TemplatePathInformation;
use App\Domain\TemplateManagement\TemplatePathInformationInterface;
use App\Domain\FormManagement\FormMeta;
/**
* @author kevinfrantz
*/
final class TemplatePathFormAndView implements TemplatePathFormAndViewInterface
{
const FORM_FOLDER = FormMeta::FOLDER;
const VIEW_FOLDER = 'view';
/**
* @var TemplatePathInformation
*/
private $form;
/**
* @var TemplatePathInformation
*/
private $view;
/**
* @param string $file
* @param string $folder
* @param string $type
*/
public function __construct(string $file, string $folder)
{
$this->setForm($file, $folder);
$this->setView($file, $folder);
}
/**
* @param string $file
* @param string $folder
*/
private function setForm(string $file, string $folder): void
{
$this->form = new TemplatePathInformation($file, $folder, self::FORM_FOLDER);
}
/**
* @param string $file
* @param string $folder
*/
private function setView(string $file, string $folder): void
{
$this->view = new TemplatePathInformation($file, $folder, $type, self::VIEW_FOLDER);
}
/**
* {@inheritdoc}
*
* @see \App\Domain\TemplateManagement\TemplatePathFormAndViewInterface::getForm()
*/
public function getForm(): TemplatePathInformationInterface
{
return $this->form;
}
/**
* {@inheritdoc}
*
* @see \App\Domain\TemplateManagement\TemplatePathFormAndViewInterface::getView()
*/
public function getView(): TemplatePathInformation
{
return $this->view;
}
/**
* {@inheritdoc}
*
* @see \App\Domain\TemplateManagement\ReloadTypeInterface::reloadType()
*/
public function reloadType(string $type): void
{
$this->view->reloadType($type);
$this->form->reloadType($type);
}
}