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