Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — master (#915)
by
unknown
04:33
created

MySqlProperties::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php declare(strict_types=1);
2
3
use Dotenv\Dotenv;
4
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
			self::CONFIG_MYSQL_HOST => $this->host,
21
			self::CONFIG_MYSQL_USER => $this->user,
22
			self::CONFIG_MYSQL_PASSWORD => $this->password,
23
			self::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 {
43
		return $this->password;
44
	}
45
46
	public function getDatabaseName(): string {
47
		return $this->databaseName;
48
	}
49
}
50