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

Failed Conditions
Pull Request — master (#1038)
by Dan
04:32
created

DatabaseProperties   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A validateConfig() 0 7 1
A getDatabaseName() 0 2 1
A getPassword() 0 2 1
A getUser() 0 2 1
A __construct() 0 9 1
A getHost() 0 2 1
1
<?php declare(strict_types=1);
2
3
namespace Smr;
4
5
use Dotenv\Dotenv;
6
7
class DatabaseProperties {
8
	private const CONFIG_HOST = "MYSQL_HOST";
9
	private const CONFIG_USER = "MYSQL_USER";
10
	private const CONFIG_PASSWORD = "MYSQL_PASSWORD";
11
	private const CONFIG_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_HOST => $this->host,
22
			self::CONFIG_USER => $this->user,
23
			self::CONFIG_PASSWORD => $this->password,
24
			self::CONFIG_DATABASE => $this->databaseName,
25
		] = $array;
26
	}
27
28
	private static function validateConfig(Dotenv $config) {
29
		$config->required([
30
			self::CONFIG_HOST,
31
			self::CONFIG_USER,
32
			self::CONFIG_PASSWORD,
33
			self::CONFIG_DATABASE,
34
		])->notEmpty();
35
	}
36
37
	public function getHost(): string {
38
		return $this->host;
39
	}
40
41
	public function getUser(): string {
42
		return $this->user;
43
	}
44
45
	public function getPassword(): string {
46
		return $this->password;
47
	}
48
49
	public function getDatabaseName(): string {
50
		return $this->databaseName;
51
	}
52
}
53