| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class NotUniqueException extends BaseException |
||
| 10 | { |
||
| 11 | public static function permissionWithNameAlreadyCreated(string $permissionName): self |
||
| 12 | { |
||
| 13 | $e = new self("Permission with given name already created"); |
||
| 14 | $e->additionalParams = ['permissionName' => $permissionName]; |
||
| 15 | |||
| 16 | return $e; |
||
| 17 | } |
||
| 18 | |||
| 19 | public static function notUniqueRole(string $roleName): self |
||
| 20 | { |
||
| 21 | $e = new self("Role with given name already created"); |
||
| 22 | $e->additionalParams = ['roleName' => $roleName]; |
||
| 23 | |||
| 24 | return $e; |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function permissionAlreadyAttachedToRole(string $permissionName, string $roleName): self |
||
| 28 | { |
||
| 29 | $e = new self("Permission already attached to role."); |
||
| 30 | $e->additionalParams = ['permissionName' => $permissionName, 'roleName' => $roleName]; |
||
| 31 | |||
| 32 | return $e; |
||
| 33 | } |
||
| 34 | |||
| 35 | public static function childRoleAlreadyAttachedToGivenParentRole(string $childName, string $parentName): self |
||
| 36 | { |
||
| 37 | $e = new self("Child role already attached to parent role."); |
||
| 38 | $e->additionalParams = ['childRoleName' => $childName, 'parentRoleName' => $parentName]; |
||
| 39 | |||
| 40 | return $e; |
||
| 41 | } |
||
| 42 | |||
| 43 | public static function roleAlreadyAssignedToUser(string $roleName, string $userId): self |
||
| 49 | } |
||
| 50 | |||
| 51 | } |
||
| 52 |