Confirmed   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A passes() 0 11 3
A message() 0 4 1
1
<?php
2
3
namespace Infinitypaul\Validator\Rules;
4
5
class Confirmed extends Rule
6
{
7
    public function passes($field, $value, $data): bool
8
    {
9
        if (! isset($data[$field.'_confirmation'])) {
10
            return false;
11
        }
12
        if ($data[$field.'_confirmation'] !== $value) {
13
            return false;
14
        }
15
16
        return true;
17
    }
18
19
    public function message($field): string
20
    {
21
        return $field.' Doesnt Match';
22
    }
23
}
24