LocalizedIntegerTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A cast() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Bdf\Form\Leaf\Transformer;
4
5
use Attribute;
6
use NumberFormatter;
7
8
/**
9
 * Localized number transformer for integer value
10
 *
11
 * @extends LocalizedNumberTransformer<int>
12
 */
13
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
14
class LocalizedIntegerTransformer extends LocalizedNumberTransformer
15
{
16
    /**
17
     * LocalizedIntegerTransformer constructor.
18
     *
19
     * @param bool $grouping Group by thousand or not
20
     * @param NumberFormatter::ROUND_* $roundingMode
21
     * @param string|null $locale The locale to use. null for use the current locale
22
     */
23 116
    public function __construct(bool $grouping = false, int $roundingMode = NumberFormatter::ROUND_HALFUP, ?string $locale = null)
24
    {
25 116
        parent::__construct(0, $grouping, $roundingMode, $locale);
26 116
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 63
    protected function cast($value): int
32
    {
33 63
        return $value;
34
    }
35
}
36