Completed
Pull Request — master (#94)
by Alessandro
08:00
created

OutputFactory::setOutput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
    public static function getOutput(): OutputInterface
21
    {
22
        if (self::$output === null) {
23
            throw new \RuntimeException('Output instance missing');
24
        }
25
26
        return self::$output;
27
    }
28
29
    public static function setOutput(OutputInterface $output)
30
    {
31
        self::$output = $output;
32
    }
33
}
34