CredentialsDetectorResult   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A credentials() 0 5 1
1
<?php
2
3
namespace ArgentCrusade\Stronghold;
4
5
class CredentialsDetectorResult
6
{
7
    const EMAIL = 'email';
8
    const PHONE = 'phone';
9
10
    /**
11
     * @var string
12
     */
13
    public $type;
14
15
    /**
16
     * @var string
17
     */
18
    public $username;
19
20
    /**
21
     * CredentialsDetectorResult constructor.
22
     *
23
     * @param string $type
24
     * @param string $username
25
     */
26
    public function __construct(string $type, string $username)
27
    {
28
        $this->type = $type;
29
        $this->username = $username;
30
    }
31
32
    /**
33
     * Get the credentials with given password.
34
     *
35
     * @param string $password
36
     * @param string $field
37
     *
38
     * @return array
39
     */
40
    public function credentials(string $password, string $field = 'password')
41
    {
42
        return [
43
            $this->type => $this->username,
44
            $field => $password,
45
        ];
46
    }
47
}
48