RabbitConfig::getPassword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace pmill\RabbitRabbit;
3
4
class RabbitConfig
5
{
6
    /**
7
     * @var string
8
     */
9
    protected $baseUrl;
10
11
    /**
12
     * @var string
13
     */
14
    protected $username;
15
16
    /**
17
     * @var string
18
     */
19
    protected $password;
20
21
    /**
22
     * RabbitConfig constructor.
23
     *
24
     * @param array|null $config
25
     */
26 2
    public function __construct(array $config = null)
27
    {
28 2
        if ($config) {
29 1
            $this->fromArray($config);
30
        }
31 2
    }
32
33
    /**
34
     * @param array $array
35
     */
36 2
    public function fromArray(array $array): void
37
    {
38 2
        foreach ($array as $propertyName => $value) {
39 2
            if (property_exists($this, $propertyName)) {
40 2
                $this->$propertyName = $value;
41
            }
42
        }
43 2
    }
44
45
    /**
46
     * @return string
47
     */
48 2
    public function getBaseUrl(): string
49
    {
50 2
        return $this->baseUrl;
51
    }
52
53
    /**
54
     * @param string $baseUrl
55
     */
56
    public function setBaseUrl(string $baseUrl): void
57
    {
58
        $this->baseUrl = $baseUrl;
59
    }
60
61
    /**
62
     * @return string
63
     */
64 2
    public function getUsername(): string
65
    {
66 2
        return $this->username;
67
    }
68
69
    /**
70
     * @param string $username
71
     */
72
    public function setUsername(string $username): void
73
    {
74
        $this->username = $username;
75
    }
76
77
    /**
78
     * @return string
79
     */
80 2
    public function getPassword(): string
81
    {
82 2
        return $this->password;
83
    }
84
85
    /**
86
     * @param string $password
87
     */
88
    public function setPassword(string $password): void
89
    {
90
        $this->password = $password;
91
    }
92
}
93