| 1 | <?php |
||
| 11 | class Group |
||
| 12 | { |
||
| 13 | /** @var string[] */ |
||
| 14 | protected $logins = []; |
||
| 15 | |||
| 16 | /** @var bool Should the group destroy itself when empty. */ |
||
| 17 | protected $persistent = false; |
||
| 18 | |||
| 19 | /** @var string The name of the group. */ |
||
| 20 | protected $name; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Group constructor. |
||
| 24 | * |
||
| 25 | * @param string $name |
||
| 26 | */ |
||
| 27 | 6 | public function __construct($name = null) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Add user to the group. |
||
| 40 | * |
||
| 41 | * @param string $login |
||
| 42 | */ |
||
| 43 | 5 | public function addLogin($login) |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Remove user from the group. |
||
| 50 | * |
||
| 51 | * @param $login |
||
| 52 | */ |
||
| 53 | 3 | public function removeLogin($login) |
|
| 59 | |||
| 60 | /** |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | 1 | public function getName() |
|
| 67 | |||
| 68 | /** |
||
| 69 | * @return boolean |
||
| 70 | */ |
||
| 71 | 2 | public function isPersistent() |
|
| 75 | |||
| 76 | /** |
||
| 77 | * Get list of all logins in the group. |
||
| 78 | * |
||
| 79 | * @return string[] |
||
| 80 | */ |
||
| 81 | 5 | public function getLogins() |
|
| 85 | |||
| 86 | /** |
||
| 87 | * Check if user is in the group. |
||
| 88 | * |
||
| 89 | * @param string $login |
||
| 90 | * |
||
| 91 | * @return bool |
||
| 92 | */ |
||
| 93 | 1 | public function hasLogin($login) |
|
| 97 | } |