Passed
Push — 0.4.0 ( cba0fe...bc0e2e )
by Anton
03:10
created

Informer::isDemoMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Modules {
4
5
	use DB, Explorer;
6
7
	abstract class Informer {
8
9
		# Count table entries
10
11 View Code Duplication
		public static function countEntries(string $table, bool $false_on_error = false) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
13
			if (!(DB::select($table, 'COUNT(id) as count') && (DB::getLast()->rows === 1))) {
14
15
				return (!$false_on_error ? 0 : false);
16
			}
17
18
			# ------------------------
19
20
			return intval(DB::getLast()->getRow()['count']);
21
		}
22
23
		# Check if install file exists
24
25
		public static function checkInstallFile() {
26
27
			return Explorer::isFile(DIR_WWW . 'install.php');
28
		}
29
30
		# Get MySQL version
31
32
		public static function mysqlVersion() {
33
34
			if (!(DB::send("SELECT VERSION() as version") && DB::getLast()->status)) return false;
35
36
			return strval(DB::getLast()->getRow()['version']);
37
		}
38
	}
39
}
40