FieldsChecker   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A equalsTo() 0 4 1
1
<?php
2
3
namespace Vvval\Spiral\Validation\Checkers;
4
5
use Spiral\Validation\Prototypes\AbstractChecker;
6
7
class FieldsChecker extends AbstractChecker
8
{
9
    /**
10
     * Default error messages associated with checker method by name.
11
     * {@inheritdoc}
12
     */
13
    const MESSAGES = [
14
        'equalsTo' => '[[Values should match.]]',
15
    ];
16
17
    /**
18
     * Checks equality between given value and another field's value.
19
     *
20
     * @param string $value
21
     * @param string $field
22
     *
23
     * @return bool
24
     */
25
    public function equalsTo(string $value, string $field): bool
26
    {
27
        return $value === $this->getValidator()->getValue($field);
28
    }
29
}