ReplicatorCli   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 9

Test Coverage

Coverage 86.36%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 9
dl 0
loc 39
ccs 19
cts 22
cp 0.8636
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A newApplication() 0 8 1
A setApplicationInfo() 0 4 1
A registerCommands() 0 12 1
A run() 0 3 1
1
<?php
2
3
namespace Queryr\Replicator\Cli;
4
5
use Queryr\Replicator\Cli\Command\ApiImportCommand;
6
use Queryr\Replicator\Cli\Command\Bz2JsonImportCommand;
7
use Queryr\Replicator\Cli\Command\GzJsonImportCommand;
8
use Queryr\Replicator\Cli\Command\InstallCommand;
9
use Queryr\Replicator\Cli\Command\JsonDumpImportCommand;
10
use Queryr\Replicator\Cli\Command\RunTestsCommand;
11
use Queryr\Replicator\Cli\Command\UninstallCommand;
12
use Queryr\Replicator\Cli\Command\XmlDumpImportCommand;
13
use Symfony\Component\Console\Application;
14
15
/**
16
 * @licence GNU GPL v2+
17
 * @author Jeroen De Dauw < [email protected] >
18
 */
19
class ReplicatorCli {
20
21
	/**
22
	 * @var Application
23
	 */
24
	private $app;
25
26 1
	public function newApplication() :Application {
27 1
		$this->app = new Application();
28
29 1
		$this->setApplicationInfo();
30 1
		$this->registerCommands();
31
32 1
		return $this->app;
33
	}
34
35 1
	private function setApplicationInfo() {
36 1
		$this->app->setName( 'Replicator' );
37 1
		$this->app->setVersion( '0.2' );
38 1
	}
39
40 1
	private function registerCommands() {
41 1
		$this->app->add( new InstallCommand() );
42 1
		$this->app->add( new UninstallCommand() );
43
44 1
		$this->app->add( new RunTestsCommand() );
45
46 1
		$this->app->add( new XmlDumpImportCommand() );
47 1
		$this->app->add( new ApiImportCommand() );
48 1
		$this->app->add( new JsonDumpImportCommand() );
49 1
		$this->app->add( new Bz2JsonImportCommand() );
50 1
		$this->app->add( new GzJsonImportCommand() );
51 1
	}
52
53
	public function run() {
54
		$this->newApplication()->run();
55
	}
56
57
}
58