| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class PermissionsMap { |
||
| 16 | use AclCacheTrait; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | private $arrayMap; |
||
| 23 | |||
| 24 | private const CACHE_KEY = 'permissionsMap'; |
||
| 25 | |||
| 26 | public function __construct() { |
||
| 28 | } |
||
| 29 | |||
| 30 | protected function getKey($controller, $action) { |
||
| 31 | return \crc32($controller . $action) . '_'; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function addAction(string $controller, string $action, string $resource, ?string $permission = '*') { |
||
| 35 | $this->arrayMap[$this->getKey($controller, $action)] = [ |
||
| 36 | 'resource' => $resource, |
||
| 37 | 'permission' => $permission |
||
| 38 | ]; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function save() { |
||
| 43 | } |
||
| 44 | |||
| 45 | public function init() { |
||
| 46 | CacheManager::$cache->store($this->getRootKey(self::CACHE_KEY), $this->arrayMap = []); |
||
| 47 | } |
||
| 48 | |||
| 49 | public function load() { |
||
| 51 | } |
||
| 52 | } |
||
| 54 |