Completed
Push — master ( 4f2fad...dd1cd3 )
by Guillaume
07:10
created

RendererFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 2
1
<?php
2
3
namespace Hogosha\Monitor\Renderer;
4
5
use Hogosha\Monitor\Monitor;
6
use Hogosha\Monitor\Renderer\RendererInterface;
7
use Hogosha\Monitor\Renderer\TableRenderer;
8
use Webmozart\Console\Api\IO\IO;
9
10
/**
11
 * @author Guillaume Cavana <[email protected]>
12
 */
13
class RendererFactory
14
{
15
    /**
16
     * create
17
     * @param  string $type
18
     * @param  IO     $io
19
     * @return RendererInterface
20
     */
21
    public static function create($type, IO $io)
22
    {
23
        if ($type == Monitor::RENDERER_TYPE_TABLE) {
24
            return new TableRenderer($io);
25
        } else {
26
            return new ListRenderer($io);
27
        }
28
    }
29
}
30