Completed
Pull Request — master (#94)
by Alessandro
04:33
created

OutputFactory::getOutput()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 3
cts 4
cp 0.75
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 2.0625
1
<?php
2
3
namespace Paraunit\Printer;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
/**
8
 * Class OutputFactory
9
 * @package Paraunit\Printer
10
 */
11
class OutputFactory
12
{
13
    /** @var OutputInterface */
14
    private static $output;
15
16
    /**
17
     * @return OutputInterface
18
     * @throws \RuntimeException
19
     */
20 36
    public static function getOutput(): OutputInterface
21
    {
22 36
        if (self::$output === null) {
23
            throw new \RuntimeException('Output instance missing');
24
        }
25
26 36
        return self::$output;
27
    }
28
29 56
    public static function setOutput(OutputInterface $output)
30
    {
31 56
        self::$output = $output;
32
    }
33
}
34