We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 6 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
7 | class MySqlProperties { |
||
8 | private const CONFIG_MYSQL_HOST = "MYSQL_HOST"; |
||
9 | private const CONFIG_MYSQL_USER = "MYSQL_USER"; |
||
10 | private const CONFIG_MYSQL_PASSWORD = "MYSQL_PASSWORD"; |
||
11 | private const CONFIG_MYSQL_DATABASE = "MYSQL_DATABASE"; |
||
12 | private string $host; |
||
13 | private string $user; |
||
14 | private string $password; |
||
15 | private string $databaseName; |
||
16 | |||
17 | public function __construct(Dotenv $config) { |
||
18 | $array = $config->load(); |
||
19 | self::validateConfig($config); |
||
20 | [ |
||
21 | self::CONFIG_MYSQL_HOST => $this->host, |
||
22 | self::CONFIG_MYSQL_USER => $this->user, |
||
23 | self::CONFIG_MYSQL_PASSWORD => $this->password, |
||
24 | self::CONFIG_MYSQL_DATABASE => $this->databaseName, |
||
25 | ] = $array; |
||
26 | } |
||
27 | |||
28 | private static function validateConfig(Dotenv $config) { |
||
29 | $config->required(self::CONFIG_MYSQL_HOST); |
||
30 | $config->required(self::CONFIG_MYSQL_USER); |
||
31 | $config->required(self::CONFIG_MYSQL_PASSWORD); |
||
32 | $config->required(self::CONFIG_MYSQL_DATABASE); |
||
33 | } |
||
34 | |||
35 | public function getHost(): string { |
||
36 | return $this->host; |
||
37 | } |
||
38 | |||
39 | public function getUser(): string { |
||
40 | return $this->user; |
||
41 | } |
||
42 | |||
43 | public function getPassword(): string { |
||
44 | return $this->password; |
||
45 | } |
||
46 | |||
47 | public function getDatabaseName(): string { |
||
49 | } |
||
50 | } |
||
51 |