Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AccessSubjectType
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
1 / 1
 label
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Access\Domain\Model;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Access subject and target entity type classification.
13 *
14 * @package App\Core\Access\Domain\Model
15 */
16enum AccessSubjectType: string
17{
18    case USER = 'user';
19    case STRUCTURE = 'structure';
20    case ALL = 'all';
21
22    /**
23     * Returns human-readable label.
24     *
25     * @return string English label.
26     */
27    public function label(): string
28    {
29        return match ($this) {
30            self::USER => 'User',
31            self::STRUCTURE => 'Structure Unit',
32            self::ALL => 'All',
33        };
34    }
35}