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

GroupBy::setType()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace Rb\Specification\Doctrine\Query;
4
5
use Doctrine\ORM\QueryBuilder;
6
use Rb\Specification\Doctrine\AbstractSpecification;
7
use Rb\Specification\Doctrine\Helper\TypeCheckerTrait;
8
9
/**
10
 * @author  Kyle Tucker <[email protected]>
11
 */
12
class GroupBy extends AbstractSpecification
13
{
14
    use TypeCheckerTrait;
15
16
    const GROUP_BY     = 'groupBy';
17
    const ADD_GROUP_BY = 'addGroupBy';
18
19
    /** @var string[] */
20
    protected $validTypes = [self::GROUP_BY, self::ADD_GROUP_BY];
21
22
    /**
23
     * Constructor.
24
     *
25
     * @param string      $field
26
     * @param string      $type
27
     * @param string|null $dqlAlias
28
     */
29
    public function __construct($field, $type = self::ADD_GROUP_BY, $dqlAlias = null)
30
    {
31
        $this->setType($type);
32
        parent::__construct($field, $dqlAlias);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function modify(QueryBuilder $queryBuilder, $dqlAlias)
39
    {
40
        call_user_func_array(
41
            [$queryBuilder, $this->type],
42
            [
43
                $this->createPropertyWithAlias($dqlAlias),
44
            ]
45
        );
46
    }
47
}
48