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
03:30
created

MysqlProperties::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 5
rs 10
1
<?php declare(strict_types=1);
2
3
4
use Dotenv\Dotenv;
5
6
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_PORT = "MYSQL_PORT";
12
	private const CONFIG_MYSQL_DATABASE = "MYSQL_DATABASE";
13
	private string $host;
14
	private string $user;
15
	private string $password;
16
	private int $port;
17
	private string $databaseName;
18
19
	public function __construct() {
20
		$configArray = !isset($_ENV["MYSQL_CONFIG_FROM_ENVIRONMENT"])
21
			? Dotenv::createArrayBacked(ROOT)->load()
22
			: $_ENV;
23
		$this->parseConfigArray($configArray);
24
	}
25
26
	private function parseConfigArray(array $array) {
27
		[
28
			MysqlProperties::CONFIG_MYSQL_HOST => $this->host,
29
			MysqlProperties::CONFIG_MYSQL_USER => $this->user,
30
			MysqlProperties::CONFIG_MYSQL_PASSWORD => $this->password,
31
			MysqlProperties::CONFIG_MYSQL_PORT => $port,
32
			MysqlProperties::CONFIG_MYSQL_DATABASE => $this->databaseName,
33
		] = $array;
34
		$this->port = (int)$port;
35
	}
36
37
	/**
38
	 * @return string
39
	 */
40
	public function getHost(): string {
41
		return $this->host;
42
	}
43
44
	/**
45
	 * @return string
46
	 */
47
	public function getUser(): string {
48
		return $this->user;
49
	}
50
51
	/**
52
	 * @return string
53
	 */
54
	public function getPassword(): string {
55
		return $this->password;
56
	}
57
58
	/**
59
	 * @return int
60
	 */
61
	public function getPort(): int {
62
		return $this->port;
63
	}
64
65
	/**
66
	 * @return string
67
	 */
68
	public function getDatabaseName(): string {
69
		return $this->databaseName;
70
	}
71
}
72