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

OutputWriter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 4
c 5
b 0
f 1
lcom 1
cbo 2
dl 0
loc 36
ccs 11
cts 11
cp 1
rs 10

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
/**
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
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
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