mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Implemented LayerClassMap
This commit is contained in:
parent
05cd278dab
commit
a59d803d96
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\LayerManagement;
|
||||
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
use App\Exception\NotSetException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class LayerClassMap implements LayerClassMapInterface
|
||||
{
|
||||
const LAYER_CLASS_MAP = [
|
||||
LayerType::SOURCE => AbstractSource::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $layer
|
||||
*
|
||||
* @throws NotSetException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getClass(string $layer): string
|
||||
{
|
||||
if (array_key_exists($layer, self::LAYER_CLASS_MAP)) {
|
||||
return self::LAYER_CLASS_MAP[$layer];
|
||||
}
|
||||
throw new NotSetException('The requested layer is not mapped!');
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\LayerManagement;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface LayerClassMapInterface
|
||||
{
|
||||
/**
|
||||
* @param string $layer
|
||||
*
|
||||
* @return string The class which belongs to an Layer
|
||||
*/
|
||||
public static function getClass(string $layer): string;
|
||||
}
|
Loading…
Reference in New Issue
Block a user