-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPrincipal.php
46 lines (40 loc) · 972 Bytes
/
IPrincipal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* Opulence
*
* @link https://www.opulencephp.com
* @copyright Copyright (C) 2021 David Young
* @license https://github.com/opulencephp/Opulence/blob/1.2/LICENSE.md
*/
namespace Opulence\Authentication;
/**
* Defines the interface for principals to implement
*/
interface IPrincipal
{
/**
* Gets the identity
*
* @return mixed The identity of the principal
*/
public function getId();
/**
* Gets the list of role names
*
* @return array The list of role names
*/
public function getRoles() : array;
/**
* Gets the type of principal this is
*
* @return string The type
*/
public function getType() : string;
/**
* Checks if a principal has a role
*
* @param string $roleName The name of the role to check
* @return bool True if the principal has the role, otherwise false
*/
public function hasRole(string $roleName) : bool;
}