FilterConditionTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkCondition() 0 10 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rs\XmlFilter\Filter\Behavior;
6
7
use Rs\XmlFilter\Document\Element;
8
use Rs\XmlFilter\Filter\Manager\FilterManager;
9
10
trait FilterConditionTrait
11
{
12 31
    protected function checkCondition($key, $value, $options, Element $element, FilterManager $filterManager = null) : bool
13
    {
14 31
        if (is_callable($options['condition']) ||
15 31
            (is_string($options['condition']) && function_exists($options['condition']))
16
        ) {
17 6
            return (bool) $options['condition']($key, $value, $element, $filterManager);
18
        }
19
20 29
        return !$options['condition'];
21
    }
22
}
23