Completed
Push — master ( a620b9...165629 )
by Paul
01:09
created

Confirmed   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 20
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
4
namespace Infinitypaul\Validator\Rules;
5
6
7
class Confirmed extends Rule
8
{
9
10
    public function passes($field, $value, $data): bool
11
    {
12
        if(!isset($data[$field.'_confirmation'])){
13
            return false;
14
        }
15
        if($data[$field.'_confirmation'] !== $value){
16
            return false;
17
        };
18
19
        return true;
20
    }
21
22
    public function message($field): string
23
    {
24
        return $field.' Doesnt Match';
25
    }
26
}
27