-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMySQLConnection.php
More file actions
62 lines (53 loc) · 1.37 KB
/
MySQLConnection.php
File metadata and controls
62 lines (53 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
declare(strict_types=1);
namespace Symandy\DatabaseBackupBundle\Model\Connection;
final class MySQLConnection implements Connection
{
/**
* @param array<int, string> $databases
*/
public function __construct(
private readonly ?string $user = null,
private readonly ?string $password = null,
private readonly ?string $host = '127.0.0.1',
private readonly ?int $port = 3306,
private readonly array $databases = [],
) {
}
public function getUser(): ?string
{
return $this->user;
}
public function getPassword(): ?string
{
return $this->password;
}
public function getHost(): ?string
{
return $this->host;
}
public function getPort(): ?int
{
return $this->port;
}
/**
* @return array<int, string>
*/
public function getDatabases(): array
{
return $this->databases;
}
/**
* @return array{user: string|null, password: string|null, host: string|null, port: int|null, databases: array<int, string>}
*/
public function getOptions(): array
{
return [
'user' => $this->getUser(),
'password' => $this->getPassword(),
'host' => $this->getHost(),
'port' => $this->getPort(),
'databases' => $this->getDatabases(),
];
}
}