NumberFormatDataField   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\SatCatalogosPopulate\Database;
6
7
class NumberFormatDataField extends TextDataField implements DataFieldInterface
8
{
9 28
    public function __construct(string $name, int $decimals)
10
    {
11 28
        parent::__construct($name, function ($input) use ($decimals) {
12 26
            if ('' === $input) {
13 26
                return '';
14
            }
15 10
            return number_format(floatval($input), $decimals, '.', '');
16 28
        });
17
    }
18
}
19