ReplicatorCli::newApplication()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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