HttpClientAuthentication::username()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of slick/http
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Slick\Http\Client;
13
14
/**
15
 * Authentication
16
 *
17
 * @package Slick\Http\Client
18
*/
19
class HttpClientAuthentication
20
{
21
    public const AUTH_BASIC  = CURLAUTH_BASIC;
22
    public const AUTH_DIGEST = CURLAUTH_DIGEST;
23
    public const AUTH_NTLM   = CURLAUTH_NTLM;
24
    public const AUTH_ANY    = CURLAUTH_ANY;
25
26
    /**
27
     * @var string
28
     */
29
    private $username;
30
31
    /**
32
     * @var string
33
     */
34
    private $password;
35
36
    /**
37
     * @var int
38
     */
39
    private $type;
40
41
    /**
42
     * Creates an HTTP Client Authentication
43
     *
44
     * @param string $username
45
     * @param string $password
46
     * @param int    $type
47
     */
48
    public function __construct($username, $password, $type = self::AUTH_ANY)
49
    {
50
        $this->username = $username;
51
        $this->password = $password;
52
        $this->type = $type;
53
    }
54
55
    /**
56
     * User's name
57
     *
58
     * @return string
59
     */
60
    public function username()
61
    {
62
        return $this->username;
63
    }
64
65
    /**
66
     * User's password
67
     *
68
     * @return string
69
     */
70
    public function password()
71
    {
72
        return $this->password;
73
    }
74
75
    /**
76
     * Authentication type
77
     *
78
     * @return int
79
     */
80
    public function type()
81
    {
82
        return $this->type;
83
    }
84
}
85