OutputWriter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setConsoleOutput() 0 4 1
A write() 0 4 1
A getConsoleOutput() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Zenify
7
 * Copyright (c) 2014 Tomas Votruba (http://tomasvotruba.cz)
8
 */
9
10
namespace Zenify\DoctrineMigrations;
11
12
use Doctrine\DBAL\Migrations\OutputWriter as DoctrineOutputWriter;
13
use Symfony\Component\Console\Output\ConsoleOutput;
14
use Symfony\Component\Console\Output\ConsoleOutputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
18
final class OutputWriter extends DoctrineOutputWriter
19
{
20
21
	/**
22
	 * @var OutputInterface
23
	 */
24 6
	private $consoleOutput;
25
26 6
27 6
	public function setConsoleOutput(OutputInterface $consoleOutput)
28
	{
29
		$this->consoleOutput = $consoleOutput;
30
	}
31
32
33 2
	/**
34
	 * @param string $message
35 2
	 */
36 2
	public function write($message)
37
	{
38
		$this->getConsoleOutput()->writeln($message);
39
	}
40
41
42 2
	private function getConsoleOutput() : OutputInterface
43
	{
44 2
		if ($this->consoleOutput === NULL) {
45 1
			$this->consoleOutput = new ConsoleOutput;
46
		}
47 2
		return $this->consoleOutput;
48
	}
49
50
}
51