LoggingReporter   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
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 31
ccs 0
cts 18
cp 0
rs 10

6 Methods

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