Completed
Branch master (c520c0)
by Filipe
01:29
created

HttpClientAuthentication   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 66
rs 10
c 0
b 0
f 0

4 Methods

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