Authenticator::setPasswordAuthentication()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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|null
39
     */
40
    private $scheme;
41
42
    /**
43
     * Constructor.
44
     *
45
     * @param string|null $hostname The hostname.
46
     * @param PasswordAuthentication $passwordAuthentication
47
     */
48
    public function __construct(?string $hostname, PasswordAuthentication $passwordAuthentication) {
49
        $this->setHostname($hostname);
50
        $this->setPasswordAuthentication($passwordAuthentication);
51
    }
52
53
    /**
54
     * Get the password authentication.
55
     *
56
     * @return PasswordAuthentication Returns the password authentication.
57
     */
58
    public function getPasswordAuthentication(): PasswordAuthentication {
59
        return $this->passwordAuthentication;
60
    }
61
62
    /**
63
     * Get the scheme.
64
     *
65
     * @return string|null Returns the scheme.
66
     */
67
    public function getScheme(): ?string {
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): Authenticator {
78
        $this->passwordAuthentication = $passwordAuthentication;
79
        return $this;
80
    }
81
82
    /**
83
     * Set the scheme.
84
     *
85
     * @param string|null $scheme The scheme.
86
     * @return Authenticator Returns this authenticator.
87
     */
88
    public function setScheme(?string $scheme): Authenticator {
89
        $this->scheme = $scheme;
90
        return $this;
91
    }
92
}
93