Implemented Source Namespace factory

This commit is contained in:
Kevin Frantz
2018-09-17 13:38:38 +02:00
parent a8781de51a
commit c15caf03a1
2 changed files with 36 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Creator\Factory\Form\Source;
use App\Entity\SourceInterface;
/**
*
* @author kevinfrantz
*
*/
class SourceFormFactory
{
const FORM_NAMESPACE = 'App\Form\\';
/**
* @var SourceInterface
*/
private $source;
public function __construct(SourceInterface $source){
$this->source = $source;
}
public function getNamespace():string{
return self::FORM_NAMESPACE.$this->getName();
}
protected function getName(): string
{
$reflectionClass = new \ReflectionClass($this->source);
return $reflectionClass->getShortName().'Type';
}
}