Completed
Push — master ( 93fa4e...dc02e9 )
by WEBEWEB
04:24
created

Authenticator   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 70
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPasswordAuthentication() 0 3 1
A getScheme() 0 3 1
A setPasswordAuthentication() 0 4 1
A setScheme() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2018 WEBEWEB
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 WBW\Library\Core\Security;
13
14
use WBW\Library\Core\Model\Attribute\IntegerPortTrait;
15
use WBW\Library\Core\Model\Attribute\StringHostnameTrait;
16
17
/**
18
 * Authenticator.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Library\Core\Security
22
 */
23
class Authenticator {
24
25
    use IntegerPortTrait;
26
    use StringHostnameTrait;
27
28
    /**
29
     * Password authentication.
30
     *
31
     * @var PasswordAuthentication
32
     */
33
    private $passwordAuthentication;
34
35
    /**
36
     * Scheme.
37
     *
38
     * @var string
39
     */
40
    private $scheme;
41
42
    /**
43
     * Constructor.
44
     *
45
     * @param string $host The host.
46
     * @param PasswordAuthentication $passwordAuthentication
47
     */
48
    public function __construct($host, PasswordAuthentication $passwordAuthentication) {
49
        $this->host                   = $host;
0 ignored issues
show
Bug introduced by
The property host does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
50
        $this->passwordAuthentication = $passwordAuthentication;
51
    }
52
53
    /**
54
     * Get the password authentication.
55
     *
56
     * @return PasswordAuthentication Returns this password authentication.
57
     */
58
    public function getPasswordAuthentication() {
59
        return $this->passwordAuthentication;
60
    }
61
62
    /**
63
     * Get the scheme.
64
     *
65
     * @return string Returns the scheme.
66
     */
67
    public function getScheme() {
68
        return $this->scheme;
69
    }
70
71
    /**
72
     * Set the password authenticator.
73
     *
74
     * @param PasswordAuthentication $passwordAuthentication The password authentication.
75
     * @return Authenticator Returns this authenticator.
76
     */
77
    public function setPasswordAuthentication(PasswordAuthentication $passwordAuthentication) {
78
        $this->passwordAuthentication = $passwordAuthentication;
79
        return $this;
80
    }
81
82
    /**
83
     * Set the scheme.
84
     *
85
     * @param string $scheme The scheme.
86
     * @return Authenticator Returns this authenticator.
87
     */
88
    public function setScheme($scheme) {
89
        $this->scheme = $scheme;
90
        return $this;
91
    }
92
}
93