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

ValidatesPredicates::isPredicate()   A

Complexity

Conditions 5
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 5
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 5
rs 9.6111
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