Passed
Pull Request — master (#99)
by
unknown
13:18
created

QuantityFormatterFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
1
<?php declare(strict_types=1);
2
3
namespace hiqdev\php\billing\product\quantity;
4
5
use hiqdev\php\units\UnitInterface;
6
7
/**
8
 * Was created to replace {@see \hipanel\modules\finance\logic\bill\QuantityFormatterFactory}
9
 */
10
class QuantityFormatterFactory
11
{
12
    public static function create(
13
        UnitInterface $unit,
14
        QuantityFormatterDefinition $definition,
15
        FractionQuantityData $data,
16
    ): QuantityFormatterInterface {
17
        $formatterClass = $definition->formatterClass();
18
19
        return new $formatterClass($unit, $definition->getFractionUnit(), $data);
20
    }
21
}
22