mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 06:01:35 +01:00
Deleted deprecated factories
This commit is contained in:
parent
926eb0c3fb
commit
5634dad139
@ -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();
|
||||
}
|
||||
}
|
@ -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';
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user