| Total Complexity | 9 | 
| Total Lines | 80 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 15 | class Resource  | 
            ||
| 16 | { | 
            ||
| 17 | /** @var string resource name */  | 
            ||
| 18 | protected $name;  | 
            ||
| 19 | |||
| 20 | /** @var ResourceAC[] Allowed permissions */  | 
            ||
| 21 | protected $allowed = [];  | 
            ||
| 22 | |||
| 23 | /** @var ResourceAC[] Disallowed permissions */  | 
            ||
| 24 | protected $disallowed = [];  | 
            ||
| 25 | |||
| 26 | /**  | 
            ||
| 27 | * Constructor  | 
            ||
| 28 | *  | 
            ||
| 29 | * @param string $name resource name  | 
            ||
| 30 | */  | 
            ||
| 31 | public function __construct(string $name)  | 
            ||
| 32 |     { | 
            ||
| 33 | $this->name = $name;  | 
            ||
| 34 | }  | 
            ||
| 35 | |||
| 36 | /**  | 
            ||
| 37 | * Get resource name  | 
            ||
| 38 | *  | 
            ||
| 39 | * @return string  | 
            ||
| 40 | */  | 
            ||
| 41 | public function getName(): string  | 
            ||
| 44 | }  | 
            ||
| 45 | |||
| 46 | /**  | 
            ||
| 47 | * Allow the resource on a permission  | 
            ||
| 48 | *  | 
            ||
| 49 | * @param ResourceAC $permission permission  | 
            ||
| 50 | * @return self  | 
            ||
| 51 | */  | 
            ||
| 52 | public function allow(ResourceAC $permission): self  | 
            ||
| 58 | }  | 
            ||
| 59 | |||
| 60 | /**  | 
            ||
| 61 | * Disallow the resource on a permission  | 
            ||
| 62 | *  | 
            ||
| 63 | * @param ResourceAC $permission permission  | 
            ||
| 64 | * @return self  | 
            ||
| 65 | */  | 
            ||
| 66 | public function disallow(ResourceAC $permission): self  | 
            ||
| 67 |     { | 
            ||
| 68 | $permission->lock();  | 
            ||
| 69 | $this->disallowed[] = $permission;  | 
            ||
| 70 | |||
| 71 | return $this;  | 
            ||
| 72 | }  | 
            ||
| 73 | |||
| 74 | /**  | 
            ||
| 75 | * Check resource against identity  | 
            ||
| 76 | *  | 
            ||
| 77 | * @param ResourceAI $identity Identity  | 
            ||
| 78 | * @return bool  | 
            ||
| 79 | */  | 
            ||
| 80 | public function check(ResourceAI $identity): bool  | 
            ||
| 95 | }  | 
            ||
| 96 | }  | 
            ||
| 97 |