Passed
Push — master ( 0d4dfe...99ef14 )
by Vincent
07:47 queued 11s
created

LocalizedIntegerTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 3
c 1
b 0
f 1
dl 0
loc 20
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 NumberFormatter;
6
7
/**
8
 * Localized number transformer for integer value
9
 *
10
 * @extends LocalizedNumberTransformer<int>
11
 */
12
class LocalizedIntegerTransformer extends LocalizedNumberTransformer
13
{
14
    /**
15
     * LocalizedIntegerTransformer constructor.
16
     *
17
     * @param bool $grouping Group by thousand or not
18
     * @param NumberFormatter::ROUND_* $roundingMode
19
     * @param string|null $locale The locale to use. null for use the current locale
20
     */
21 115
    public function __construct(bool $grouping = false, int $roundingMode = NumberFormatter::ROUND_HALFUP, ?string $locale = null)
22
    {
23 115
        parent::__construct(0, $grouping, $roundingMode, $locale);
24 115
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 63
    protected function cast($value): int
30
    {
31 63
        return $value;
32
    }
33
}
34