ExactValueContinuationValidator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A describeObject() 0 4 1
A isValid() 0 4 1
A skipValidation() 0 4 1
1
<?php
2
3
namespace fieldwork\validators;
4
5
use fieldwork\validators;
6
7
/**
8
 * Class ExactValueContinuationValidator
9
 * Adding this validator to the front of a field's validation stack will cause the rest of the validators to be skipped
10
 * (and effectively evaluated to true) if the value of the field equals $breakValue
11
 * @package fieldwork\validators
12
 */
13
class ExactValueContinuationValidator extends validators\FieldValidator
14
{
15
16
    private $breakValue = "";
17
18
    function __construct ($breakValue)
19
    {
20
        $this->breakValue = $breakValue;
21
    }
22
23
    function describeObject ()
24
    {
25
        return 'breakonvalue';
26
    }
27
28
    public function isValid ($value)
29
    {
30
        return true;
31
    }
32
33
    public function skipValidation ($value)
34
    {
35
        return $value === $this->breakValue;
36
    }
37
38
39
}