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
Push — master ( f54b59...2b88e7 )
by Rik
05:03 queued 02:46
created

Having::isSatisfiedBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
c 1
b 0
f 1
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Rb\Specification\Doctrine\Query;
4
5
use Doctrine\ORM\QueryBuilder;
6
use Rb\Specification\Doctrine\Exception\InvalidArgumentException;
7
use Rb\Specification\Doctrine\SpecificationInterface;
8
9
10
/**
11
 * @author  Kyle Tucker <[email protected]>
12
 */
13
class Having implements SpecificationInterface
14
{
15
    const HAVING     = 'having';
16
    const AND_HAVING = 'andHaving';
17
    const OR_HAVING  = 'orHaving';
18
19
    protected static $types = [self::HAVING, self::AND_HAVING, self::OR_HAVING];
20
21
    /** @var  string */
22
    protected $type;
23
24
    /** @var  SpecificationInterface */
25
    protected $specification;
26
27
    public function __construct(SpecificationInterface $specification, $type = self::AND_HAVING)
28
    {
29
        $this->specification = $specification;
30
        $this->setType($type);
31
    }
32
33
    public function modify(QueryBuilder $queryBuilder, $dqlAlias)
34
    {
35
        call_user_func_array(
36
            [$queryBuilder, $this->type],
37
            [
38
                $this->specification->modify($queryBuilder, $dqlAlias),
39
            ]
40
        );
41
    }
42
43
    public function isSatisfiedBy($value)
44
    {
45
        return true;
46
    }
47
48 View Code Duplication
    public function setType($type)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
49
    {
50
        if (!in_array($type, self::$types)) {
51
            throw new InvalidArgumentException(sprintf(
52
                '"%s" is not a valid type! Valid types: %s',
53
                $type,
54
                implode(', ', self::$types)
55
            ));
56
        }
57
58
        $this->type = $type;
59
    }
60
}
61