Passed
Push — master ( 4a94bb...6969fa )
by Georges
02:59 queued 10s
created

Config::getPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Geolim4
5
 * Date: 12/02/2018
6
 * Time: 23:10
7
 */
8
9
namespace Phpfastcache\Drivers\Mongodb;
10
11
use Phpfastcache\Config\ConfigurationOption;
12
13
class Config extends ConfigurationOption
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $host = '127.0.0.1';
19
20
    /**
21
     * @var int
22
     */
23
    protected $port = 27017;
24
25
    /**
26
     * @var int
27
     */
28
    protected $timeout = 3;
29
30
    /**
31
     * @var string
32
     */
33
    protected $username = '';
34
35
    /**
36
     * @var string
37
     */
38
    protected $password = '';
39
40
    /**
41
     * @var array
42
     */
43
    protected $servers = [];
44
45
    /**
46
     * @var string
47
     */
48
    protected $collectionName = 'Cache';
49
50
    /**
51
     * @var string
52
     */
53
    protected $databaseName = Driver::MONGODB_DEFAULT_DB_NAME;
54
55
    /**
56
     * @var array
57
     */
58
    protected $options = [];
59
60
    /**
61
     * @return string
62
     */
63
    public function getHost(): string
64
    {
65
        return $this->host;
66
    }
67
68
    /**
69
     * @param string $host
70
     * @return self
71
     */
72
    public function setHost(string $host): self
73
    {
74
        $this->host = $host;
75
        return $this;
76
    }
77
78
    /**
79
     * @return int
80
     */
81
    public function getPort(): int
82
    {
83
        return $this->port;
84
    }
85
86
    /**
87
     * @param int $port
88
     * @return self
89
     */
90
    public function setPort(int $port): self
91
    {
92
        $this->port = $port;
93
        return $this;
94
    }
95
96
    /**
97
     * @return int
98
     */
99
    public function getTimeout(): int
100
    {
101
        return $this->timeout;
102
    }
103
104
    /**
105
     * @param int $timeout
106
     * @return self
107
     */
108
    public function setTimeout(int $timeout): self
109
    {
110
        $this->timeout = $timeout;
111
        return $this;
112
    }
113
114
    /**
115
     * @return string
116
     */
117
    public function getUsername(): string
118
    {
119
        return $this->username;
120
    }
121
122
    /**
123
     * @param string $username
124
     * @return self
125
     */
126
    public function setUsername(string $username): self
127
    {
128
        $this->username = $username;
129
        return $this;
130
    }
131
132
    /**
133
     * @return string
134
     */
135
    public function getPassword(): string
136
    {
137
        return $this->password;
138
    }
139
140
    /**
141
     * @param string $password
142
     * @return self
143
     */
144
    public function setPassword(string $password): self
145
    {
146
        $this->password = $password;
147
        return $this;
148
    }
149
150
    /**
151
     * @return string
152
     */
153
    public function getServers(): array
154
    {
155
        return $this->servers;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->servers returns the type array which is incompatible with the documented return type string.
Loading history...
156
    }
157
158
    /**
159
     * @param string $servers
160
     * @return self
161
     */
162
    public function setServers(array $servers): self
163
    {
164
        $this->servers = $servers;
165
        return $this;
166
    }
167
168
    /**
169
     * @return string
170
     */
171
    public function getCollectionName(): string
172
    {
173
        return $this->collectionName;
174
    }
175
176
    /**
177
     * @param string $collectionName
178
     * @return self
179
     */
180
    public function setCollectionName(string $collectionName): self
181
    {
182
        $this->collectionName = $collectionName;
183
        return $this;
184
    }
185
186
    /**
187
     * @return string
188
     */
189
    public function getDatabaseName(): string
190
    {
191
        return $this->databaseName;
192
    }
193
194
    /**
195
     * @param string $databaseName
196
     * @return self
197
     */
198
    public function setDatabaseName(string $databaseName): self
199
    {
200
        $this->databaseName = $databaseName;
201
        return $this;
202
    }
203
204
    /**
205
     * @return array
206
     */
207
    public function getOptions(): array
208
    {
209
        return $this->options;
210
    }
211
212
    /**
213
     * @see https://docs.mongodb.com/manual/reference/connection-string/#connections-connection-options
214
     * @param array $options
215
     * @return Config
216
     */
217
    public function setOptions(array $options): self
218
    {
219
        $this->options = $options;
220
        return $this;
221
    }
222
}