mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Implemented LayerClassMap
This commit is contained in:
		| @@ -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; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user