1 | <?php |
||
15 | class UserAuthenticator |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var \PDO PDO |
||
20 | */ |
||
21 | protected $pdo; |
||
22 | |||
23 | /** |
||
24 | * @var Configuration |
||
25 | */ |
||
26 | protected $configuration; |
||
27 | |||
28 | /** |
||
29 | * UserAuthenticator constructor. |
||
30 | * |
||
31 | * @param \PDO $pdo |
||
32 | * @param Configuration $configuration |
||
33 | */ |
||
34 | public function __construct(\PDO $pdo, Configuration $configuration) |
||
39 | |||
40 | /** |
||
41 | * Authenticate user object from cookie |
||
42 | * |
||
43 | * @param Cookie $cookie Cookie object |
||
44 | * |
||
45 | * @return User|null User if a user ID is sent in cookie |
||
|
|||
46 | */ |
||
47 | public function userFromCookie(Cookie $cookie) |
||
65 | |||
66 | /** |
||
67 | * Sign in an user |
||
68 | * |
||
69 | * @param User $user User object |
||
70 | * @param string $password User password |
||
71 | * |
||
72 | * @return bool Returns true if sign in was successful, otherwise false will be returned |
||
73 | */ |
||
74 | public function signIn(User $user, string $password): bool |
||
120 | } |
||
121 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.