ExactValueContinuationValidator::isValid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
}