Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SerializedPermission | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
2.50 | |
0.00% |
0 / 1 |
| getPermissionIdentifiers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getRegularExpression | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Apie\Core\Permissions; |
| 4 | |
| 5 | use Apie\Core\Attributes\Description; |
| 6 | use Apie\Core\Lists\PermissionList; |
| 7 | use Apie\Core\ValueObjects\Interfaces\HasRegexValueObjectInterface; |
| 8 | use Apie\Core\ValueObjects\IsStringWithRegexValueObject; |
| 9 | |
| 10 | #[Description('A serialized permission identifier, for example "user:read"')] |
| 11 | final class SerializedPermission implements PermissionInterface, HasRegexValueObjectInterface |
| 12 | { |
| 13 | use IsStringWithRegexValueObject; |
| 14 | |
| 15 | public function getPermissionIdentifiers(): PermissionList |
| 16 | { |
| 17 | return new PermissionList([$this->internal]); |
| 18 | } |
| 19 | |
| 20 | public static function getRegularExpression(): string |
| 21 | { |
| 22 | return '/^[a-z:]+$/'; |
| 23 | } |
| 24 | } |