Completed
Pull Request — master (#5)
by Alessandro
03:07
created

ClientConfiguration::getPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\MongoDbBundle\Models;
6
7
/**
8
 * Class ClientConfiguration.
9
 */
10
class ClientConfiguration
11
{
12
    /** @var string */
13
    private $host;
14
    /** @var int */
15
    private $port;
16
    /** @var string */
17
    private $username;
18
    /** @var string */
19
    private $password;
20
21
    /**
22
     * ClientConfiguration constructor.
23
     *
24
     * @param string $host
25
     * @param int    $port
26
     * @param string $username
27
     * @param string $password
28
     */
29 4
    public function __construct(string $host, int $port, string $username = '', string $password = '')
30
    {
31 4
        $this->host = $host;
32 4
        $this->port = $port;
33 4
        $this->username = $username;
34 4
        $this->password = $password;
35 4
    }
36
37
    /**
38
     * @return string
39
     */
40 7
    public function getHost(): string
41
    {
42 7
        return $this->host;
43
    }
44
45
    /**
46
     * @return int
47
     */
48 7
    public function getPort(): int
49
    {
50 7
        return $this->port;
51
    }
52
53
    /**
54
     * @return string
55
     */
56 6
    public function getUsername(): string
57
    {
58 6
        return $this->username;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64 5
    public function hasCredentials(): bool
65
    {
66 5
        return !empty($this->username);
67
    }
68
69
    /**
70
     * @return string
71
     */
72 6
    public function getPassword(): string
73
    {
74 6
        return $this->password;
75
    }
76
}
77