ConsoleStatsReporter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A reportStats() 0 23 1
1
<?php
2
3
namespace Queryr\Replicator\Cli\Import;
4
5
use Queryr\Replicator\Importer\ImportStats;
6
use Queryr\Replicator\Importer\StatsReporter;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * @licence GNU GPL v2+
11
 * @author Jeroen De Dauw < [email protected] >
12
 */
13
class ConsoleStatsReporter implements StatsReporter {
14
15
	private $output;
16
17
	public function __construct( OutputInterface $output ) {
18
		$this->output = $output;
19
	}
20
21
	public function reportStats( ImportStats $stats ) {
22
		$this->output->writeln( "\n" );
23
24
		$this->output->writeln( '<info>Import stats:</info>' );
25
26
		$this->output->writeln(
27
			sprintf(
28
				'<comment>Entities: %d (%d succeeded, %d (%g%%) failed)</comment>',
29
				$stats->getEntityCount(),
30
				$stats->getSuccessCount(),
31
				$stats->getErrorCount(),
32
				$stats->getErrorRatio()
33
			)
34
		);
35
36
		$this->output->writeln(
37
			sprintf(
38
				'<comment>Duration: %g seconds (%d entities/second)</comment>',
39
				$stats->getDurationInMs(),
40
				$stats->getEntityCount() / $stats->getDurationInMs()
41
			)
42
		);
43
	}
44
45
}
46