AbstractCompareValidator::isValid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Lavibi\Popoya;
4
5
abstract class AbstractCompareValidator extends AbstractValidator
6
{
7
    /**
8
     * Required options.
9
     *
10
     * @var string[]
11
     */
12
    protected $requiredOptions = [
13
        'compared_value'
14
    ];
15
16
    /**
17
     * @param mixed $value
18
     *
19
     * @return bool
20
     *
21
     * @throws Exception\MissingOptionException
22
     */
23 13
    public function isValid($value)
24
    {
25 13
        $this->value = $this->standardValue = $value;
26
27 13
        $this->checkMissingOptions();
28
29 10
        return $this->compare();
30
    }
31
32
    /**
33
     * Compare value
34
     *
35
     * @return bool
36
     */
37
    abstract protected function compare();
38
}
39