I::init()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
c 2
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php
2
namespace Tivnet\WPDB;
3
4
use Symfony\Component\Console\Application;
5
6
/**
7
 * Class I: the Instance.
8
 */
9
class I {
10
11
	/**
12
	 * @var Config
13
	 */
14
	public static $cfg;
15
16
	/**
17
	 * @var Application
18
	 */
19
	public static $app;
20
21
	/**
22
	 * Constructor.
23
	 */
24
	public static function init() {
25
		self::$cfg = new Config();
26
		if ( ! self::$cfg->is_error ) {
27
			self::runApplication();
28
		}
29
	}
30
31
	/**
32
	 * Configure and run the application.
33
	 */
34
	protected static function runApplication() {
35
		self::$app = new Application( Config::APPLICATION_TITLE, '@package_version@' );
36
		self::$app->addCommands( array(
37
			new Command\DumpCommand(),
38
			new Command\HiCommand(),
39
			new Command\ListDumpsCommand(),
40
			new Command\LoadCommand(),
41
			new Command\SelfUpdateCommand(),
42
		) );
43
		self::$app->run();
44
	}
45
}
46