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,63 @@
<?php
namespace App\Domain\FormManagement;
use App\Domain\SourceManagement\SourceMetaInterface;
use App\Domain\TemplateManagement\TemplateMetaInterface;
use App\Domain\TemplateManagement\TemplateMeta;
/**
* @author kevinfrantz
*
* @todo Optimize contructor parameter!
*/
class FormMeta implements FormMetaInterface
{
const FOLDER = 'form';
/**
* @var SourceMetaInterface
*/
private $sourceMeta;
/**
* @var TemplateMetaInterface
*/
private $templateMeta;
/**
* @var string
*/
private $formClass;
public function __construct(SourceMetaInterface $sourceMeta)
{
$this->sourceMeta = $sourceMeta;
$this->setMeta();
$this->setFormClass();
}
private function setFormClass(): void
{
$this->formClass = 'App\\Form';
foreach ($this->sourceMeta->getBasicPathArray() as $element) {
$this->formClass .= '\\'.ucfirst($element);
}
$this->formClass .= '\\'.ucfirst($this->sourceMeta->getBasicName()).'Type';
}
private function setMeta(): void
{
$this->templateMeta = new TemplateMeta($this->sourceMeta->getBasicPathArray(), $this->sourceMeta->getBasicName(), self::FOLDER);
}
public function getFormClass(): string
{
return $this->formClass;
}
public function getTemplateMeta(): TemplateMetaInterface
{
return $this->templateMeta;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Domain\FormManagement;
use App\Domain\TemplateManagement\TemplateMetaInterface;
interface FormMetaInterface
{
public function getFormClass(): string;
public function getTemplateMeta(): TemplateMetaInterface;
}