RangeStrategy   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 14.29%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 24
ccs 2
cts 14
cp 0.1429
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttributeClassName() 0 3 1
A getValidatorProperty() 0 3 1
A generateArguments() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Library\DTO\Preparation\Processor\Property\Assert;
15
16
use Symfony\Component\Validator\Constraints\Range;
17
18
class RangeStrategy extends LengthStrategy
19
{
20
    protected function generateArguments(array $config): array
21
    {
22
        $parent = parent::generateArguments($config);
23
        $current = [
24
            'invalidDateTimeMessage' => $config['invalid_datetime_message'] ?? null,
25
            'invalidMessage' => $config['invalid_message'] ?? null,
26
            'maxPropertyPath' => $config['property_path_max'] ?? null,
27
            'minPropertyPath' => $config['property_path_min'] ?? null,
28
            'notInRangeMessage' => $config['message_not_in_range'] ?? null,
29
        ];
30
31
        return array_filter(array_merge($parent, $current));
32
    }
33
34 1
    protected function getValidatorProperty(): string
35
    {
36 1
        return 'range';
37
    }
38
39
    protected function getAttributeClassName(): string
40
    {
41
        return Range::class;
42
    }
43
}
44