ValidatesPredicates   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A isPredicate() 0 16 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\FluentAQL\Traits;
6
7
use LaravelFreelancerNL\FluentAQL\Expressions\PredicateExpression;
8
9
trait ValidatesPredicates
10
{
11 4
    public function isPredicate(mixed $value): bool
12
    {
13 4
        if ($value instanceof PredicateExpression) {
14 4
            return true;
15
        }
16
17
        if (
18 4
            is_array($value)
19 4
            && isset($value[0])
20 4
            && ! is_array($value[0])
21 4
            && ! $value[0] instanceof PredicateExpression
22
        ) {
23 4
            return true;
24
        }
25
26 4
        return false;
27
    }
28
}
29