Completed
Push — master ( 4dc03d...bf54d1 )
by Gregory
22:33
created

Config::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 10
cp 0
rs 9.4285
cc 3
eloc 7
nc 4
nop 0
crap 12
1
<?php
2
namespace Tivnet\WPDB;
3
4
/**
5
 * Class Config
6
 * @package Tivnet\WPDB
7
 */
8
class Config {
9
	public static $dir_dump = 'dbdump-data';
10
	public static $dump_ext = 'sql';
11
	public static $cmd_ls = 'ls -o --time-style long-iso';
12
13
	/**
14
	 * Config constructor.
15
	 */
16
	public function __construct() {
17
		$config = array();
18
19
		$file_config = getcwd() . '/.wpdb.json';
20
		if ( is_readable( $file_config ) ) {
21
			$config = json_decode( file_get_contents( $file_config ), JSON_OBJECT_AS_ARRAY );
22
		}
23
24
		if ( ! empty( $config['dir_dump'] ) ) {
25
			self::$dir_dump = $config['dir_dump'];
26
		}
27
28
	}
29
30
}
31