Completed
Push — master ( 2b5604...0a5d2b )
by Burhan
17s queued 11s
created

BarcodeGeneratorFactory::getGenerator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 2
rs 10
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 1
        switch ($type) {
18
            case BarcodeType::EAN13:
19
            default:
20 1
                $class = BarcodeGeneratorEan13::class;
21 1
                break;
22
        }
23
24 1
        return new $class();
25
    }
26
}
27