FloatDataField   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

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