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 | 43 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 5 | class MySqlProperties { |
||
| 6 | private const CONFIG_MYSQL_HOST = "MYSQL_HOST"; |
||
| 7 | private const CONFIG_MYSQL_USER = "MYSQL_USER"; |
||
| 8 | private const CONFIG_MYSQL_PASSWORD = "MYSQL_PASSWORD"; |
||
| 9 | private const CONFIG_MYSQL_DATABASE = "MYSQL_DATABASE"; |
||
| 10 | private string $host; |
||
| 11 | private string $user; |
||
| 12 | private string $password; |
||
| 13 | private string $databaseName; |
||
| 14 | |||
| 15 | public function __construct() { |
||
| 16 | $config = Dotenv::createArrayBacked(ROOT); |
||
| 17 | $array = $config->load(); |
||
| 18 | self::validateConfig($config); |
||
| 19 | [ |
||
| 20 | MySqlProperties::CONFIG_MYSQL_HOST => $this->host, |
||
| 21 | MySqlProperties::CONFIG_MYSQL_USER => $this->user, |
||
| 22 | MySqlProperties::CONFIG_MYSQL_PASSWORD => $this->password, |
||
| 23 | MySqlProperties::CONFIG_MYSQL_DATABASE => $this->databaseName, |
||
| 24 | ] = $array; |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function validateConfig(Dotenv $config) { |
||
| 28 | $config->required(self::CONFIG_MYSQL_HOST); |
||
| 29 | $config->required(self::CONFIG_MYSQL_USER); |
||
| 30 | $config->required(self::CONFIG_MYSQL_PASSWORD); |
||
| 31 | $config->required(self::CONFIG_MYSQL_DATABASE); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getHost(): string { |
||
| 35 | return $this->host; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getUser(): string { |
||
| 39 | return $this->user; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getPassword(): string { |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getDatabaseName(): string { |
||
| 48 | } |
||
| 49 | } |
||
| 50 |