| Total Complexity | 7 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare( strict_types=1 ); |
||
| 10 | class User extends Element { |
||
| 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 | * Returns a regex for matching the name of this user |
||
| 53 | * |
||
| 54 | * @inheritDoc |
||
| 55 | */ |
||
| 56 | public function getRegex() : string { |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | public function __toString() { |
||
| 67 |