GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#22)
by Rik
02:05
created

Between::generateParameterName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Rb\Specification\Doctrine\Condition;
4
5
use Doctrine\ORM\QueryBuilder;
6
use Rb\Specification\Doctrine\AbstractSpecification;
7
use Rb\Specification\Doctrine\Helper\ParameterTrait;
8
9
class Between extends AbstractSpecification
10
{
11
    use ParameterTrait;
12
13
    /**
14
     * @var mixed
15
     */
16
    protected $from;
17
18
    /**
19
     * @var mixed
20
     */
21
    protected $to;
22
23
    /**
24
     * @param string      $field
25
     * @param mixed       $from
26
     * @param mixed       $to
27
     * @param string|null $dqlAlias
28
     */
29
    public function __construct($field, $from, $to, $dqlAlias = null)
30
    {
31
        $this->from = $from;
32
        $this->to   = $to;
33
34
        parent::__construct($field, $dqlAlias);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function modify(QueryBuilder $queryBuilder, $dqlAlias)
41
    {
42
        $fromParam = $this->generateParameterName($queryBuilder, 'from');
43
        $toParam   = $this->generateParameterName($queryBuilder, 'to');
44
45
        $queryBuilder->setParameter($fromParam, $this->from);
46
        $queryBuilder->setParameter($toParam, $this->to);
47
48
        return (string) $queryBuilder->expr()->between(
49
            $this->createPropertyWithAlias($dqlAlias),
50
            sprintf(':%s', $fromParam),
51
            sprintf(':%s', $toParam)
52
        );
53
    }
54
}
55