OutputWriter::write()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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