SimpleReporter   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 33
ccs 0
cts 19
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A started() 0 5 1
A endedSuccessfully() 0 3 1
A endedWithError() 0 4 1
A stepStarted() 0 2 1
A stepCompleted() 0 3 1
1
<?php
2
3
namespace Queryr\Replicator\Cli\Import;
4
5
use Queryr\Replicator\Importer\PageImportReporter;
6
use Queryr\Replicator\Model\EntityPage;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * @licence GNU GPL v2+
11
 * @author Jeroen De Dauw < [email protected] >
12
 */
13
class SimpleReporter implements PageImportReporter {
14
15
	private $output;
16
17
	private $number = 0;
18
19
	public function __construct( OutputInterface $output ) {
20
		$this->output = $output;
21
	}
22
23
	public function started( EntityPage $entityPage ) {
24
		$this->output->write(
25
			"\n<info>Importing entity " . ++$this->number . ': ' . $entityPage->getTitle() . '...</info>'
26
		);
27
	}
28
29
	public function endedSuccessfully() {
30
		$this->output->writeln( '<info> Entity imported.</info>' );
31
	}
32
33
	public function endedWithError( \Exception $ex ) {
34
		$this->output->writeln( '<error>FAILED!</error>' );
35
		$this->output->writeln( '<error>Error details: ' . $ex->getMessage() . '</error>' );
36
	}
37
38
	public function stepStarted( string $message ) {
39
	}
40
41
	public function stepCompleted() {
42
		$this->output->write( '<info>..</info>' );
43
	}
44
45
}