BetweenInclusiveRule   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 14 3
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Validator\Rule;
13
14
/**
15
 * Check for value in range between minimum and maximum values
16
 *
17
 * @package Bluz\Validator\Rule
18
 */
19
class BetweenInclusiveRule extends BetweenRule
20
{
21
    /**
22
     * @var bool
23
     */
24
    protected $inclusive = true;
25
26
    /**
27
     * Get error template
28
     *
29
     * @return string
30
     */
31 8
    public function getDescription(): string
32
    {
33
34 8
        $min = $this->minValue;
35 8
        $max = $this->maxValue;
36
37 8
        if ($min instanceof \DateTime) {
38 2
            $min = date_format($min, 'r');
39
        }
40 8
        if ($max instanceof \DateTime) {
41 2
            $max = date_format($max, 'r');
42
        }
43
44 8
        return __('must be inclusive between "%1s" and "%2s"', $min, $max);
45
    }
46
}
47