| Total Complexity | 6 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 15 | class Users implements AuthInterface |
||
| 16 | { |
||
| 17 | |||
| 18 | const _NAME = 'name'; |
||
| 19 | const _ROLE = 'role'; |
||
| 20 | const _VALID = 'valid'; |
||
| 21 | const _ACCOUNTS = 'accounts'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * app config |
||
| 25 | * |
||
| 26 | * @var Config |
||
| 27 | */ |
||
| 28 | private $config; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * accounts list |
||
| 32 | * |
||
| 33 | * @var array |
||
| 34 | */ |
||
| 35 | private $accounts; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * instanciate |
||
| 39 | * |
||
| 40 | * @param Config $config |
||
| 41 | */ |
||
| 42 | 3 | public function __construct(Config $config) |
|
| 43 | { |
||
| 44 | 3 | $this->config = $config; |
|
| 45 | 3 | $this->accounts = $this->config->getSettings(self::_ACCOUNTS); |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * auth a user for a given email and password |
||
| 50 | * |
||
| 51 | * @param string $email |
||
| 52 | * @param string $password |
||
| 53 | * @return array |
||
| 54 | */ |
||
| 55 | 1 | public function auth(string $email, string $password): array |
|
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * return user array for a given user id |
||
| 72 | * |
||
| 73 | * @param integer $uid |
||
| 74 | * @return array |
||
| 75 | */ |
||
| 76 | 1 | public function getById(int $uid): array |
|
| 82 | } |
||
| 83 | } |
||
| 84 |