TCheckEntry   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkValue() 0 9 3
1
<?php
2
3
namespace kalanis\kw_rules\Rules;
4
5
6
use kalanis\kw_rules\Exceptions\RuleException;
7
use kalanis\kw_rules\Interfaces\IValidate;
8
9
10
/**
11
 * trait TCheckEntry
12
 * @package kalanis\kw_rules\Rules
13
 * Check original values as another entry
14
 */
15
trait TCheckEntry
16
{
17
    use TRule;
18
19
    /**
20
     * @param mixed|null $againstValue
21
     * @throws RuleException
22
     * @return IValidate
23
     */
24 4
    protected function checkValue($againstValue)
25
    {
26 4
        if (!is_object($againstValue)) {
27 1
            throw new RuleException('Input is not an object.');
28
        }
29 3
        if (! ($againstValue instanceof IValidate) ) {
30 1
            throw new RuleException(sprintf('Input %s is not instance of IValidate.', get_class($againstValue)));
31
        }
32 2
        return $againstValue;
33
    }
34
}
35