| 1 | <?php |
||
| 7 | class Auth |
||
| 8 | { |
||
| 9 | private $users; |
||
| 10 | |||
| 11 | public function __construct() |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Login. |
||
| 22 | * |
||
| 23 | * @param string $login |
||
| 24 | * @param string $password |
||
| 25 | * |
||
| 26 | * @return bool |
||
| 27 | */ |
||
| 28 | public function login($login, $password) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Verify is usser logged. |
||
| 45 | */ |
||
| 46 | public function isLogged() |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Logout user. |
||
| 64 | * |
||
| 65 | * @return bool |
||
| 66 | */ |
||
| 67 | public function logout() |
||
| 74 | } |
||
| 75 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: