Passed
Pull Request — master (#534)
by
unknown
02:44
created

Number::getTooBigMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Rule;
6
7
use Attribute;
8
use Closure;
9
10
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
11
final class Number extends AbstractNumber
12
{
13
    public function __construct(
14
        float|int|null $min = null,
15
        float|int|null $max = null,
16
        string $incorrectInputMessage = 'The allowed types are integer, float and string.',
17
        string $notNumberMessage = 'Value must be a number.',
18
        string $tooSmallMessage = 'Value must be no less than {min}.',
19
        string $tooBigMessage = 'Value must be no greater than {max}.',
20
        string $pattern = '/^\s*[-+]?\d*\.?\d+([eE][-+]?\d+)?\s*$/',
21
        mixed $skipOnEmpty = null,
22
        bool $skipOnError = false,
23
        Closure|null $when = null,
24
    ) {
25
        parent::__construct(
26
            min: $min,
27
            max: $max,
28
            incorrectInputMessage: $incorrectInputMessage,
29
            notNumberMessage: $notNumberMessage,
30
            tooSmallMessage: $tooSmallMessage,
31
            tooBigMessage: $tooBigMessage,
32 36
            pattern: $pattern,
33
            skipOnEmpty: $skipOnEmpty,
34
            skipOnError: $skipOnError,
35
            when: $when,
36
        );
37
    }
38
39
    public function getName(): string
40
    {
41
        return 'number';
42
    }
43
}
44