Completed
Push — master ( fd3130...674c45 )
by John
03:39
created

BarcodeGeneratorFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
ccs 6
cts 7
cp 0.8571
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getGenerator() 0 10 2
1
<?php
2
3
namespace Graze\CiffRenderer\BarcodeGenerator;
4
5
use Graze\CiffRenderer\BarcodeGenerator\BarcodeGeneratorInterface;
6
use Graze\CiffRenderer\BarcodeGenerator\BarcodeType;
7
use Graze\CiffRenderer\BarcodeGenerator\BarcodeGeneratorEan13;
8
9
class BarcodeGeneratorFactory
10
{
11
    /**
12
     * @param string $type
13
     * @return BarcodeGeneratorInterface
14
     */
15 1
    public function getGenerator($type)
16
    {
17
        switch ($type) {
18 1
            case BarcodeType::EAN13:
19 1
            default:
20 1
                $class = BarcodeGeneratorEan13::class;
21 1
                break;
22
        }
23
24 1
        return new $class();
25
    }
26
}
27