| Total Complexity | 6 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare( strict_types=1 ); |
||
| 10 | class User { |
||
| 11 | /** @var string */ |
||
| 12 | private $name; |
||
| 13 | /** @var string[] */ |
||
| 14 | private $groups; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param string $name |
||
| 18 | */ |
||
| 19 | public function __construct( string $name ) { |
||
| 20 | $this->name = $name; |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return string |
||
| 25 | */ |
||
| 26 | public function getName() : string { |
||
| 27 | return $this->name; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return string[] |
||
| 32 | */ |
||
| 33 | public function getGroups() : array { |
||
| 34 | if ( $this->groups === null ) { |
||
| 35 | $usersList = PageBotList::get()->getAdminsList(); |
||
| 36 | $this->groups = array_keys( $usersList[ $this->name ] ); |
||
| 37 | } |
||
| 38 | return $this->groups; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Whether the user is in the given group |
||
| 43 | * |
||
| 44 | * @param string $groupName |
||
| 45 | * @return bool |
||
| 46 | */ |
||
| 47 | public function inGroup( string $groupName ) : bool { |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | public function __toString() { |
||
| 56 | } |
||
| 57 | } |
||
| 58 |