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

Between   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExpr() 0 7 1
A getName() 0 3 1
1
<?php declare(strict_types = 1);
2
3
namespace Artprima\QueryFilterBundle\Query\Condition;
4
5
use Doctrine\ORM\QueryBuilder;
6
7
/**
8
 * Class Between
9
 *
10
 * @author Denis Voytyuk <[email protected]>
11
 *
12
 * @package Artprima\QueryFilterBundle\Query\Condition
13
 */
14
class Between implements ConditionInterface
15
{
16
    public function getExpr(QueryBuilder $qb, string $field, int $index, array $val)
17
    {
18
        $expr = $qb->expr()->between($field, ':x'.$index, ':y'.$index);
19
        $qb->setParameter('x'.$index, $val['x'] ?? '');
20
        $qb->setParameter('y'.$index, $val['y'] ?? '');
21
22
        return $expr;
23
    }
24
25
    public function getName(): string
26
    {
27
        return 'between';
28
    }
29
}