Failed Conditions
Push — master ( bc79fb...9e41f7 )
by Denis
02:47
created

MemberOf::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types = 1);
2
3
namespace Artprima\QueryFilterBundle\Query\Condition;
4
5
use Doctrine\ORM\QueryBuilder;
6
use Doctrine\ORM\Query as DoctrineQuery;
7
8
/**
9
 * Class MemberOf
10
 *
11
 * @author Denis Voytyuk <[email protected]>
12
 *
13
 * @package Artprima\QueryFilterBundle\Query\Condition
14
 */
15
class MemberOf implements ConditionInterface
16
{
17
    public function getExpr(QueryBuilder $qb, string $field, int $index, array $val)
18
    {
19
        $expr = new DoctrineQuery\Expr\Comparison('?' . $index, 'MEMBER OF', $field);
20
        $qb->setParameter($index, $val['val'] ?? '');
21
22
        return $expr;
23
    }
24
25
    public function getName(): string
26
    {
27
        return 'member of';
28
    }
29
}