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

OutputFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 23
ccs 5
cts 6
cp 0.8333
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOutput() 0 8 2
A setOutput() 0 4 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 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