Failed Conditions
Push — newinternal ( b66232...216d62 )
by Simon
16:33 queued 06:35
created

ICredentialProvider

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
authenticate() 0 1 ?
setCredential() 0 1 ?
deleteCredential() 0 1 ?
userIsEnrolled() 0 1 ?
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
Documentation introduced by
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 @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
31
32
    /**
33
     * @param User $user
34
     */
35
    public function deleteCredential(User $user);
0 ignored issues
show
Documentation introduced by
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 @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
36
37
    /**
38
     * @param int $userId
39
     *
40
     * @return bool
41
     */
42
    public function userIsEnrolled($userId);
43
}