mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 01:09:41 +00:00 
			
		
		
		
	Optimized FormMeta and Tests
This commit is contained in:
		| @@ -8,6 +8,8 @@ use App\Domain\TemplateManagement\TemplateMeta; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  * | ||||
|  * @todo Optimize contructor parameter! | ||||
|  */ | ||||
| class FormMeta implements FormMetaInterface | ||||
| { | ||||
| @@ -37,7 +39,11 @@ class FormMeta implements FormMetaInterface | ||||
|  | ||||
|     private function setFormClass(): void | ||||
|     { | ||||
|         $this->formClass = 'App\\Form\\'.implode('\\', $this->sourceMeta->getBasicPathArray()).'\\'.$this->sourceMeta->getBasicName().'Type'; | ||||
|         $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 | ||||
| @@ -50,7 +56,7 @@ class FormMeta implements FormMetaInterface | ||||
|         return $this->formClass; | ||||
|     } | ||||
|  | ||||
|     public function getTemplateMeta(): string | ||||
|     public function getTemplateMeta(): TemplateMetaInterface | ||||
|     { | ||||
|         return $this->templateMeta; | ||||
|     } | ||||
|   | ||||
| @@ -2,9 +2,11 @@ | ||||
|  | ||||
| namespace App\Domain\FormManagement; | ||||
|  | ||||
| use App\Domain\TemplateManagement\TemplateMetaInterface; | ||||
|  | ||||
| interface FormMetaInterface | ||||
| { | ||||
|     public function getFormClass(): string; | ||||
|  | ||||
|     public function getTemplateMeta(): string; | ||||
|     public function getTemplateMeta(): TemplateMetaInterface; | ||||
| } | ||||
|   | ||||
| @@ -13,6 +13,8 @@ use App\Domain\FormManagement\FormMeta; | ||||
|  */ | ||||
| class SourceMeta implements SourceMetaInterface | ||||
| { | ||||
|     const FOLDER = 'entity'; | ||||
|  | ||||
|     /** | ||||
|      * @var \ReflectionClass | ||||
|      */ | ||||
| @@ -55,10 +57,15 @@ class SourceMeta implements SourceMetaInterface | ||||
|         $this->setBasicPathArray(); | ||||
|         $this->setBasicName(); | ||||
|         $this->setInterfaceReflection(); | ||||
|         $this->templateMeta = new TemplateMeta($this->basicPathArray, $this->basicName, 'entity'); | ||||
|         $this->setTemplateMeta(); | ||||
|         $this->formMeta = new FormMeta($this); | ||||
|     } | ||||
|  | ||||
|     private function setTemplateMeta(): void | ||||
|     { | ||||
|         $this->templateMeta = new TemplateMeta($this->basicPathArray, $this->basicName, self::FOLDER); | ||||
|     } | ||||
|  | ||||
|     private function setBasicPathArray(): void | ||||
|     { | ||||
|         $namespace = $this->sourceReflection->getNamespaceName(); | ||||
|   | ||||
| @@ -94,9 +94,4 @@ class TemplateMeta implements TemplateMetaInterface | ||||
|     { | ||||
|         return $this->type; | ||||
|     } | ||||
|  | ||||
|     public function getPathSuffix(): string | ||||
|     { | ||||
|         return $this->pathSuffix; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user