2019-01-27 19:47:41 +01:00
|
|
|
<?php
|
|
|
|
|
2019-05-30 16:18:10 +02:00
|
|
|
namespace Infinito\Domain\Layer;
|
2019-01-27 19:47:41 +01:00
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
|
|
|
use Infinito\DBAL\Types\ActionType;
|
2019-05-30 16:20:42 +02:00
|
|
|
use Infinito\Domain\Map\AbstractMap;
|
2019-01-27 19:47:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
2019-01-29 20:02:36 +01:00
|
|
|
final class LayerActionMap extends AbstractMap implements LayerActionMapInterface
|
2019-01-27 19:47:41 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var array Add new combination possibilities to this map!
|
|
|
|
*/
|
|
|
|
const LAYER_ACTION_MAP = [
|
|
|
|
LayerType::SOURCE => [
|
|
|
|
ActionType::READ,
|
|
|
|
ActionType::CREATE,
|
|
|
|
ActionType::UPDATE,
|
|
|
|
ActionType::DELETE,
|
2019-02-18 21:09:57 +01:00
|
|
|
ActionType::EXECUTE,
|
2019-01-27 19:47:41 +01:00
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-05-30 16:18:10 +02:00
|
|
|
* @see \Infinito\Domain\Layer\LayerActionMapInterface::getLayers()
|
2019-01-27 19:47:41 +01:00
|
|
|
*/
|
|
|
|
public static function getLayers(string $action): array
|
|
|
|
{
|
2019-01-29 20:02:36 +01:00
|
|
|
return parent::getIndizesByValue($action, self::LAYER_ACTION_MAP);
|
2019-01-27 19:47:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
2019-05-30 16:18:10 +02:00
|
|
|
* @see \Infinito\Domain\Layer\LayerActionMapInterface::getActions()
|
2019-01-27 19:47:41 +01:00
|
|
|
*/
|
|
|
|
public static function getActions(string $layer): array
|
|
|
|
{
|
2019-01-29 20:02:36 +01:00
|
|
|
return parent::getValuesByIndex($layer, self::LAYER_ACTION_MAP);
|
2019-01-27 19:47:41 +01:00
|
|
|
}
|
|
|
|
}
|