mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Optimized draft for meta and template informations
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\FormManagement;
|
||||
|
||||
use App\Domain\TemplateManagement\TemplatePathInformationInterface;
|
||||
use App\Domain\EntityManagement\EntityMetaInformationInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class FormMetaInformation implements FormMetaInformationInterface
|
||||
{
|
||||
const FOLDER = 'form';
|
||||
|
||||
/**
|
||||
* @var EntityMetaInformationInterface
|
||||
*/
|
||||
private $entityMetaInformation;
|
||||
|
||||
/**
|
||||
* @var TemplatePathInformationInterface
|
||||
*/
|
||||
private $templatePathInformation;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $formClass;
|
||||
|
||||
/**
|
||||
* @param EntityMetaInformationInterface $entityMetaInformation
|
||||
*/
|
||||
public function __construct(EntityMetaInformationInterface $entityMetaInformation)
|
||||
{
|
||||
$this->entityMetaInformation = $entityMetaInformation;
|
||||
$this->setTemplateMetaInformation();
|
||||
$this->setFormClass();
|
||||
}
|
||||
|
||||
private function setFormClass(): void
|
||||
{
|
||||
$this->formClass = 'App\\Form';
|
||||
foreach ($this->entityMetaInformation->getBasicPathArray() as $element) {
|
||||
$this->formClass .= '\\'.ucfirst($element);
|
||||
}
|
||||
$this->formClass .= '\\'.ucfirst($this->entityMetaInformation->getPureName()).'Type';
|
||||
}
|
||||
|
||||
private function setTemplateMetaInformation(): void
|
||||
{
|
||||
$this->templatePathInformation = $this->entityMetaInformation->getTemplatePathFormAndView()->getForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\FormManagement\FormMetaInformationInterface::getFormClass()
|
||||
*/
|
||||
public function getFormClass(): string
|
||||
{
|
||||
return $this->formClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\FormManagement\FormMetaInformationInterface::getTemplatePathInformation()
|
||||
*/
|
||||
public function getTemplatePathInformation(): TemplatePathInformationInterface
|
||||
{
|
||||
return $this->templatePathInformation;
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\FormManagement;
|
||||
|
||||
use App\Domain\TemplateManagement\TemplatePathInformationInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface FormMetaInformationInterface
|
||||
{
|
||||
/**
|
||||
* @return string The string to the form class
|
||||
*/
|
||||
public function getFormClass(): string;
|
||||
|
||||
/**
|
||||
* @return TemplatePathInformationInterface The form template path information
|
||||
*/
|
||||
public function getTemplatePathInformation(): TemplatePathInformationInterface;
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\FormManagement;
|
||||
|
||||
use App\Domain\TemplateManagement\TemplateMetaInterface;
|
||||
|
||||
interface FormMetaInterface
|
||||
{
|
||||
public function getFormClass(): string;
|
||||
|
||||
public function getTemplateMeta(): TemplateMetaInterface;
|
||||
}
|
Reference in New Issue
Block a user