StatsTrackingReporter::stepStarted()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
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\Importer;
4
5
use Exception;
6
use Queryr\Replicator\Model\EntityPage;
7
8
/**
9
 * @licence GNU GPL v2+
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
class StatsTrackingReporter implements PageImportReporter {
13
14
	private $reporter;
15
16
	/**
17
	 * @var ImportStats
18
	 */
19
	private $stats;
20
21 1
	public function __construct( PageImportReporter $reporter ) {
22 1
		$this->reporter = $reporter;
23 1
		$this->stats = new ImportStats();
24 1
	}
25
26
	public function started( EntityPage $entityPage ) {
27
		$this->reporter->started( $entityPage );
28
	}
29
30
	public function endedSuccessfully() {
31
		$this->reporter->endedSuccessfully();
32
		$this->stats->recordSuccess();
33
	}
34
35
	public function endedWithError( Exception $ex ) {
36
		$this->reporter->endedWithError( $ex );
37
		$this->stats->recordError( $ex );
38
	}
39
40
	public function stepStarted( string $message ) {
41
		$this->reporter->stepStarted( $message );
42
	}
43
44
	public function stepCompleted() {
45
		$this->reporter->stepCompleted();
46
	}
47
48 1
	public function getStats() {
49 1
		return $this->stats;
50
	}
51
52
}