Passed
Push — master ( f8f76e...e5015c )
by Bas
12:29
created

ValidatesPredicates   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

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