Deleted deprecated factories

This commit is contained in:
Kevin Frantz 2018-11-23 16:51:46 +01:00
parent 926eb0c3fb
commit 5634dad139
4 changed files with 0 additions and 110 deletions

View File

@ -1,28 +0,0 @@
<?php
namespace App\Creator\Factory;
use App\Entity\Source\SourceInterface;
/**
* @author kevinfrantz
*/
abstract class AbstractSourceFactory
{
/**
* @var SourceInterface
*/
protected $source;
public function __construct(SourceInterface $source)
{
$this->source = $source;
}
protected function getSourceClassShortName(): string
{
$reflection = new \ReflectionClass($this->source);
return $reflection->getShortName();
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Creator\Factory\Form\Source;
use App\Creator\Factory\AbstractSourceFactory;
/**
* @author kevinfrantz
*/
final class SourceFormFactory extends AbstractSourceFactory
{
const FORM_NAMESPACE = 'App\Form\\';
public function getNamespace(): string
{
return self::FORM_NAMESPACE.$this->getName();
}
protected function getName(): string
{
return $this->getSourceClassShortName().'Type';
}
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Creator\Factory\Template\Source;
use App\Entity\Source\SourceInterface;
use Symfony\Component\HttpFoundation\Request;
use App\Creator\Factory\AbstractSourceFactory;
/**
* @author kevinfrantz
*/
class SourceTemplateFactory extends AbstractSourceFactory
{
const SOURCE_TEMPLATE_ROOT = 'source';
const VIEW_FOLDER = 'view';
/**
* @var Request
*/
protected $request;
/**
* @param SourceInterface $source
*/
public function __construct(SourceInterface $source, Request $request)
{
parent::__construct($source);
$this->request = $request;
}
public function getTemplatePath(): string
{
return self::SOURCE_TEMPLATE_ROOT.'/'.self::VIEW_FOLDER.'/'.$this->generateName().'.'.$this->request->getRequestFormat().'.twig';
}
protected function generateName(): string
{
$lowerName = strtolower($this->getSourceClassShortName());
return str_replace('source', '', $lowerName);
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace App\Creator\Factory\Template\Source;
/**
* @author kevinfrantz
*/
final class SourceTemplateFormFactory extends SourceTemplateFactory
{
const FORM_FOLDER = 'form';
public function getTemplatePath(): string
{
return parent::SOURCE_TEMPLATE_ROOT.'/'.self::FORM_FOLDER.'/'.$this->generateName().'.'.$this->request->getRequestFormat().'.twig';
}
}