Completed
Push — master ( 2704f9...f273e8 )
by Tomáš
02:19
created

OutputWriter::setConsoleOutput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of Zenify
5
 * Copyright (c) 2014 Tomas Votruba (http://tomasvotruba.cz)
6
 */
7
8
namespace Zenify\DoctrineMigrations;
9
10
use Doctrine\DBAL\Migrations\OutputWriter as DoctrineOutputWriter;
11
use Symfony\Component\Console\Output\ConsoleOutput;
12
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
Coding Style introduced by Tomas Votruba
As per PSR2, there should be exactly one blank line after the last USE statement, 2 were found though.
Loading history...
13
14
15
final class OutputWriter extends DoctrineOutputWriter
16
{
17
18
	/**
19
	 * @var OutputInterface
20
	 */
21
	private $consoleOutput;
22
23
24 6
	public function setConsoleOutput(OutputInterface $consoleOutput)
25
	{
26 6
		$this->consoleOutput = $consoleOutput;
27 6
	}
28
29
30
	/**
31
	 * {@inheritdoc}
32
	 */
33 2
	public function write($message)
34
	{
35 2
		$this->getConsoleOutput()->writeln($message);
36 2
	}
37
38
39
	/**
40
	 * @return ConsoleOutput
41
	 */
42 2
	private function getConsoleOutput()
43
	{
44 2
		if ($this->consoleOutput === NULL) {
45 1
			$this->consoleOutput = new ConsoleOutput;
46 1
		}
47 2
		return $this->consoleOutput;
48
	}
49
50
}
1 ignored issue
show
Coding Style introduced by Tomas Votruba
According to PSR2, the closing brace of classes should be placed on the next line directly after the body.

Below you find some examples:

// Incorrect placement according to PSR2
class MyClass
{
    public function foo()
    {

    }
    // This blank line is not allowed.

}

// Correct
class MyClass
{
    public function foo()
    {

    } // No blank lines after this line.
}
Loading history...
51