enwikipedia-acc /
waca
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /****************************************************************************** |
||
| 3 | * Wikipedia Account Creation Assistance tool * |
||
| 4 | * * |
||
| 5 | * All code in this file is released into the public domain by the ACC * |
||
| 6 | * Development Team. Please see team.json for a list of contributors. * |
||
| 7 | ******************************************************************************/ |
||
| 8 | |||
| 9 | namespace Waca\Security\CredentialProviders; |
||
| 10 | |||
| 11 | use Waca\DataObjects\User; |
||
| 12 | |||
| 13 | interface ICredentialProvider |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Validates a user-provided credential |
||
| 17 | * |
||
| 18 | * @param User $user The user to test the authentication against |
||
| 19 | * @param string $data The raw credential data to be validated |
||
| 20 | * |
||
| 21 | * @return bool |
||
| 22 | */ |
||
| 23 | public function authenticate(User $user, $data); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param User $user The user the credential belongs to |
||
| 27 | * @param int $factor The factor this credential provides |
||
| 28 | * @param string $data |
||
| 29 | */ |
||
| 30 | public function setCredential(User $user, $factor, $data); |
||
|
0 ignored issues
–
show
|
|||
| 31 | |||
| 32 | /** |
||
| 33 | * @param User $user |
||
| 34 | */ |
||
| 35 | public function deleteCredential(User $user); |
||
|
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a Loading history...
|
|||
| 36 | |||
| 37 | /** |
||
| 38 | * @param int $userId |
||
| 39 | * |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | public function userIsEnrolled($userId); |
||
| 43 | } |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@returndoc comment to communicate to implementors of these methods what they are expected to return.