| 1 | <?php |
||
| 10 | class Auth |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var AccountManagerInterface |
||
| 14 | */ |
||
| 15 | private $accountManager; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var LoginManagerInterface |
||
| 19 | */ |
||
| 20 | private $loginManager; |
||
| 21 | |||
| 22 | public function __construct() |
||
| 27 | |||
| 28 | public function viewLoginForm() |
||
| 32 | |||
| 33 | public function doLogin() |
||
| 38 | |||
| 39 | public function doLogout() |
||
| 44 | } |
||
| 45 |
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: