SimpleReporter::endedWithError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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