IsNotInArray   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 8
ccs 3
cts 3
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 4 2
1
<?php
2
3
namespace kalanis\kw_rules\Rules;
4
5
6
use kalanis\kw_rules\Interfaces\IValidate;
7
use kalanis\kw_rules\Exceptions\RuleException;
8
9
10
/**
11
 * Class IsNotInArray
12
 * @package kalanis\kw_rules\Rules
13
 * Check if input is not in preset array
14
 */
15
class IsNotInArray extends ARule
16
{
17
    use TCheckArrayString;
18
19 5
    public function validate(IValidate $entry): void
20
    {
21 5
        if (in_array(strval($entry->getValue()), (array) $this->againstValue)) {
22 3
            throw new RuleException($this->errorText);
23
        }
24 2
    }
25
}
26