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

Eq::getExpr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 4
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 9.4285
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
7
/**
8
 * Class Eq
9
 *
10
 * @author Denis Voytyuk <[email protected]>
11
 *
12
 * @package Artprima\QueryFilterBundle\Query\Condition
13
 */
14
class Eq implements ConditionInterface
15
{
16
    public function getExpr(QueryBuilder $qb, string $field, int $index, array $val)
17
    {
18
        $expr = $qb->expr()->eq($field, '?'.$index);
19
        $qb->setParameter($index, $val['val'] ?? '');
20
21
        return $expr;
22
    }
23
24
    public function getName(): string
25
    {
26
        return 'eq';
27
    }
28
}