Completed
Push — master ( 9a9942...efdf92 )
by Alessandro
04:04
created

ClientConfiguration   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 70
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getHost() 0 4 1
A getPort() 0 4 1
A getUsername() 0 4 1
A getPassword() 0 4 1
A getCredentialsArray() 0 7 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 4
    public function getHost(): string
41
    {
42 4
        return $this->host;
43
    }
44
45
    /**
46
     * @return int
47
     */
48 4
    public function getPort(): int
49
    {
50 4
        return $this->port;
51
    }
52
53
    /**
54
     * @return string
55
     */
56 2
    public function getUsername(): string
57
    {
58 2
        return $this->username;
59
    }
60
61
    /**
62
     * @return string
63
     */
64 2
    public function getPassword(): string
65
    {
66 2
        return $this->password;
67
    }
68
69
    /**
70
     * @return array
71
     */
72 2
    public function getCredentialsArray(): array
73
    {
74
        return [
75 2
            'username' => $this->username,
76 2
            'password' => $this->password,
77
        ];
78
    }
79
}
80