| Total Complexity | 8 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class DBAuth |
||
| 10 | { |
||
| 11 | private $db; |
||
| 12 | protected $globals; |
||
| 13 | |||
| 14 | public function __construct(MysqlDatabase $db) |
||
| 15 | { |
||
| 16 | $this->db = $db; |
||
| 17 | $this->globals = new Globals; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Returns the Id of the connected User |
||
| 22 | * @return mixed $id|false |
||
| 23 | */ |
||
| 24 | public function getUserId() |
||
| 25 | { |
||
| 26 | if ($this->logged()) { |
||
| 27 | return $this->SESSION["auth"]; |
||
|
|
|||
| 28 | } |
||
| 29 | return \false; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Check the login |
||
| 34 | * @param string $usernameOrEmail |
||
| 35 | * @param string $password |
||
| 36 | * @return bool |
||
| 37 | * @throws PDOException |
||
| 38 | */ |
||
| 39 | public function login(string $usernameOrEmail, string $password): bool |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Checks if the Visitor is logged |
||
| 54 | * @return bool |
||
| 55 | */ |
||
| 56 | public function logged(): bool |
||
| 59 | } |
||
| 60 | } |
||
| 61 |