Passed
Push — master ( b2e03a...bc8242 )
by
unknown
04:12 queued 01:10
created

Compare   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Rule;
6
7
use Attribute;
8
9
/**
10
 * Defines validation options to check that the specified value matches with another value or attribute.
11
 *
12
 * The value being compared with a constant {@see Compare::$targetValue}, which is set
13
 * in the constructor.
14
 *
15
 * It supports different comparison operators, specified via the {@see Compare::$operator}.
16
 *
17
 * There are shortcut classes to use instead of specifying operator manually:
18
 *
19
 * - {@see Equal} is a shortcut for `new Compare(operator: '==')` and `new Compare(operator: '===')`.
20
 * - {@see NotEqual} is a shortcut for `new Compare(operator: '!=')` and `new Compare(operator: '!==')`.
21
 * - {@see GreaterThan} is a shortcut for `new Compare(operator: '>')`.
22
 * - {@see GreaterThanOrEqual} is a shortcut for `new Compare(operator: '>=')`.
23
 * - {@see LessThan} is a shortcut for `new Compare(operator: '<')`.
24
 * - {@see LessThanOrEqual} is a shortcut for `new Compare(operator: '<=')`.
25
 *
26
 * The default comparison function is based on string values, which means the values
27
 * are compared byte by byte. When comparing numbers, make sure to change {@see Compare::$type} to
28
 * {@see CompareType::NUMBER} to enable numeric comparison.
29
 *
30
 * @see CompareHandler
31
 */
32
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
33
final class Compare extends AbstractCompare
34
{
35
    public function getName(): string
36
    {
37
        return 'compare';
38
    }
39
}
40