mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
In between commit implementing security layer
This commit is contained in:
28
application/src/Creator/Factory/AbstractSourceFactory.php
Normal file
28
application/src/Creator/Factory/AbstractSourceFactory.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Creator\Factory;
|
||||
|
||||
use App\Entity\SourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Creator\Factory\Facade\Security;
|
||||
|
||||
use App\Structur\Facade\Security\Source\interfaces\SourceFacadeInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class SourceFacadeFactory
|
||||
{
|
||||
public function getSourceFacade(): SourceFacadeInterface
|
||||
{
|
||||
$className = $this->getSourceFacadeClassName();
|
||||
|
||||
return new $className();
|
||||
}
|
||||
|
||||
private function getSourceFacadeClassName(): string
|
||||
{
|
||||
return 'App\Structur\Facade\Security\Source\\'.$this->getSourceFacadeClassName().'Facade';
|
||||
}
|
||||
}
|
@@ -2,25 +2,15 @@
|
||||
|
||||
namespace App\Creator\Factory\Form\Source;
|
||||
|
||||
use App\Entity\SourceInterface;
|
||||
use Creator\Factory\AbstractSourceFactory;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SourceFormFactory
|
||||
final class SourceFormFactory extends AbstractSourceFactory
|
||||
{
|
||||
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();
|
||||
@@ -28,8 +18,6 @@ class SourceFormFactory
|
||||
|
||||
protected function getName(): string
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass($this->source);
|
||||
|
||||
return $reflectionClass->getShortName().'Type';
|
||||
return $this->getSourceClassShortName().'Type';
|
||||
}
|
||||
}
|
||||
|
@@ -4,21 +4,17 @@ namespace App\Creator\Factory\Template\Source;
|
||||
|
||||
use App\Entity\SourceInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Creator\Factory\AbstractSourceFactory;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SourceTemplateFactory
|
||||
class SourceTemplateFactory extends AbstractSourceFactory
|
||||
{
|
||||
const SOURCE_TEMPLATE_ROOT = 'source';
|
||||
|
||||
const VIEW_FOLDER = 'view';
|
||||
|
||||
/**
|
||||
* @var SourceInterface
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* @var Request
|
||||
*/
|
||||
@@ -29,7 +25,7 @@ class SourceTemplateFactory
|
||||
*/
|
||||
public function __construct(SourceInterface $source, Request $request)
|
||||
{
|
||||
$this->source = $source;
|
||||
parent::__construct($source);
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
@@ -40,9 +36,7 @@ class SourceTemplateFactory
|
||||
|
||||
protected function generateName(): string
|
||||
{
|
||||
$reflection = new \ReflectionClass($this->source);
|
||||
$shortName = $reflection->getShortName();
|
||||
$lowerName = strtolower($shortName);
|
||||
$lowerName = strtolower($this->getSourceClassShortName());
|
||||
|
||||
return str_replace('source', '', $lowerName);
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ namespace App\Creator\Factory\Template\Source;
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SourceTemplateFormFactory extends SourceTemplateFactory
|
||||
final class SourceTemplateFormFactory extends SourceTemplateFactory
|
||||
{
|
||||
const FORM_FOLDER = 'form';
|
||||
|
||||
|
Reference in New Issue
Block a user