Completed
Push — 15.x ( 8474b2 )
by Tim
07:20
created

Database::setTablePrefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Configuration\Database
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-configuration-jms
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Configuration\Jms\Configuration;
22
23
use JMS\Serializer\Annotation\Type;
24
use JMS\Serializer\Annotation\SerializedName;
25
use TechDivision\Import\Configuration\DatabaseConfigurationInterface;
26
27
/**
28
 * The database configuration.
29
 *
30
 * @author    Tim Wagner <[email protected]>
31
 * @copyright 2016 TechDivision GmbH <[email protected]>
32
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
33
 * @link      https://github.com/techdivision/import-configuration-jms
34
 * @link      http://www.techdivision.com
35
 */
36
class Database implements DatabaseConfigurationInterface
37
{
38
39
    /**
40
     * The database identifier for this database connection.
41
     *
42
     * @var string
43
     * @Type("string")
44
     * @SerializedName("id")
45
     */
46
    protected $id;
47
48
    /**
49
     * The PDO DSN to use.
50
     *
51
     * @var string
52
     * @Type("string")
53
     * @SerializedName("pdo-dsn")
54
     */
55
    protected $dsn;
56
57
    /**
58
     * The database host to use.
59
     *
60
     * @var string
61
     * @Type("string")
62
     */
63
    protected $host;
64
65
    /**
66
     * The database port to use.
67
     *
68
     * @var string
69
     * @Type("integer")
70
     */
71
    protected $port;
72
73
    /**
74
     * The DB username to use.
75
     *
76
     * @var string
77
     * @Type("string")
78
     */
79
    protected $username;
80
81
    /**
82
     * The DB password to use.
83
     *
84
     * @var string
85
     * @Type("string")
86
     */
87
    protected $password;
88
89
    /**
90
     * The flag to signal the default datasource or not.
91
     *
92
     * @var boolean
93
     * @Type("boolean")
94
     * @SerializedName("default")
95
     */
96
    protected $default = false;
97
98
    /**
99
     * The DB timeout to use.
100
     *
101
     * @var integer
102
     * @Type("integer")
103
     */
104
    protected $timeout;
105
106
    /**
107
     * The DB version to use.
108
     *
109
     * @var string
110
     * @Type("string")
111
     */
112
    protected $version;
113
114
    /**
115
     * The DB name to use.
116
     *
117
     * @var string
118
     * @Type("string")
119
     */
120
    protected $name;
121
122
    /**
123
     * The DB table prefix to use.
124
     *
125
     * @var string
126
     * @Type("string")
127
     * @SerializedName("table-prefix")
128
     */
129
    protected $tablePrefix;
130
131
    /**
132
     * The DB type to use.
133
     *
134
     * @var string
135
     * @Type("string")
136
     */
137
    protected $type = DatabaseConfigurationInterface::TYPE_MYSQL;
138
139
    /**
140
     * Set's the database identifier for this database connection.
141
     *
142
     * @param string $id The database identifier
143
     *
144
     * @return void
145
     */
146
    public function setId($id)
147
    {
148
        $this->id = $id;
149
    }
150
151
    /**
152
     * Return's the database identifier for this database connection.
153
     *
154
     * @return string The database identifier
155
     */
156
    public function getId()
157
    {
158
        return $this->id;
159
    }
160
161
    /**
162
     * Set's the PDO DSN to use.
163
     *
164
     * @param string $dsn The PDO DSN
165
     *
166
     * @return void
167
     */
168
    public function setDsn($dsn)
169
    {
170
        $this->dsn = $dsn;
171
    }
172
173
    /**
174
     * Return's the PDO DSN to use.
175
     *
176
     * @return string The PDO DSN
177
     */
178
    public function getDsn()
179
    {
180
        return $this->dsn;
181
    }
182
183
    /**
184
     * Set's the DB username to use.
185
     *
186
     * @param string $username The DB username
187
     *
188
     * @return void
189
     */
190
    public function setUsername($username)
191
    {
192
        $this->username = $username;
193
    }
194
195
    /**
196
     * Return's the DB username to use.
197
     *
198
     * @return string The DB username
199
     */
200
    public function getUsername()
201
    {
202
        return $this->username;
203
    }
204
205
    /**
206
     * Set's the DB password to use.
207
     *
208
     * @param string $password The DB password
209
     *
210
     * @return void
211
     */
212
    public function setPassword($password)
213
    {
214
        $this->password = $password;
215
    }
216
217
    /**
218
     * Return's the DB password to use.
219
     *
220
     * @return string The DB password
221
     */
222
    public function getPassword()
223
    {
224
        return $this->password;
225
    }
226
227
    /**
228
     * Set's the flag to signal that this is the default datasource or not.
229
     *
230
     * @param boolean $default TRUE if this is the default datasource, else FALSE
231
     *
232
     * @return void
233
     */
234
    public function setDefault($default)
235
    {
236
        $this->default = $default;
237
    }
238
239
    /**
240
     * Set's the DB table prefix to use.
241
     *
242
     * @param string $tablePrefix The DB table prefix
243
     *
244
     * @return void
245
     */
246
    public function setTablePrefix($tablePrefix)
247
    {
248
        $this->tablePrefix = $tablePrefix;
249
    }
250
251
    /**
252
     * Return's the flag to signal that this is the default datasource or not.
253
     *
254
     * @return boolean TRUE if this is the default datasource, else FALSE
255
     */
256
    public function isDefault()
257
    {
258
        return $this->default;
259
    }
260
261
    /**
262
     * Return's the DB name to use.
263
     *
264
     * @return string The DB name
265
     */
266
    public function getName()
267
    {
268
        return $this->name;
269
    }
270
271
    /**
272
     * Return's the DB timeout to use.
273
     *
274
     * @return integer The DB timeout
275
     */
276
    public function getTimeout()
277
    {
278
        return $this->timeout;
279
    }
280
281
    /**
282
     * Return's the DB version to use.
283
     *
284
     * @return string The DB version
285
     */
286
    public function getVersion()
287
    {
288
        return $this->version;
289
    }
290
291
    /**
292
     * Return's the DB host to use.
293
     *
294
     * @return string The DB host
295
     */
296
    public function getHost()
297
    {
298
        return $this->host;
299
    }
300
301
    /**
302
     * Return's the DB port to use.
303
     *
304
     * @return integer The DB port
305
     */
306
    public function getPort()
307
    {
308
        return $this->port;
309
    }
310
311
    /**
312
     * Return's the DB type to use.
313
     *
314
     * @return string The DB type
315
     */
316
    public function getType()
317
    {
318
        return $this->type;
319
    }
320
321
    /**
322
     * Return's the DB table prefix to use.
323
     *
324
     * @return string The DB table prefix
325
     */
326
    public function getTablePrefix()
327
    {
328
        return $this->tablePrefix;
329
    }
330
}
331