Completed
Pull Request — master (#9)
by Asmir
163:43 queued 133:54
created

Security::setPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace GoetasWebservices\SoapServices\SoapClient\WssWsSecurity;
4
5
class Security
6
{
7
    /**
8
     * (UT 3.1) Password type: plain text.
9
     */
10
    const PASSWORD_TYPE_TEXT = 0;
11
12
    /**
13
     * (UT 3.1) Password type: digest.
14
     */
15
    const PASSWORD_TYPE_DIGEST = 1;
16
17
    /**
18
     * (UT 3.1) Password.
19
     *
20
     * @var string
21
     */
22
    protected $password;
23
24
    /**
25
     * (UT 3.1) Password type: text or digest.
26
     *
27
     * @var int
28
     */
29
    protected $passwordType = self::PASSWORD_TYPE_DIGEST;
30
31
    /**
32
     * (UT 3.1) Username.
33
     *
34
     * @var string
35
     */
36
    protected $username;
37
38
    /**
39
     * @return string
40
     */
41
    public function getPassword()
42
    {
43
        return $this->password;
44
    }
45
46
    /**
47
     * @param string $password
48
     * @param int $passwordType
49
     */
50
    public function setPassword($password, $passwordType = self::PASSWORD_TYPE_DIGEST)
51
    {
52
        $this->password = $password;
53
        $this->passwordType = $passwordType;
54
    }
55
56
    public function isPasswordDigest()
57
    {
58
        return $this->passwordType === self::PASSWORD_TYPE_DIGEST;
59
    }
60
61
    public function isPasswordPlain()
62
    {
63
        return $this->passwordType === self::PASSWORD_TYPE_TEXT;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getUsername()
70
    {
71
        return $this->username;
72
    }
73
74
    /**
75
     * @param string $username
76
     */
77
    public function setUsername($username)
78
    {
79
        $this->username = $username;
80
    }
81
}
82