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 (#24)
by Julián
02:32
created

SpecificationFactory::__callStatic()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 6
nc 2
nop 2
1
<?php
2
3
namespace Rb\Specification\Doctrine;
4
5
/**
6
 * Class SpecificationFactory.
7
 */
8
class SpecificationFactory
9
{
10
    /**
11
     * Specification map.
12
     *
13
     * @var array
14
     */
15
    static protected $supportedSpecifications = [
16
        'Between' => 'Rb\Specification\Doctrine\Condition\Between',
17
        'Comparison' => 'Rb\Specification\Doctrine\Condition\Comparison',
18
        'Equals' => 'Rb\Specification\Doctrine\Condition\Equals',
19
        'EqualsProperty' => 'Rb\Specification\Doctrine\Condition\EqualsProperty',
20
        'GreaterThan' => 'Rb\Specification\Doctrine\Condition\GreaterThan',
21
        'GreaterThanOrEquals' => 'Rb\Specification\Doctrine\Condition\GreaterThanOrEquals',
22
        'In' => 'Rb\Specification\Doctrine\Condition\In',
23
        'IsInstanceOf' => 'Rb\Specification\Doctrine\Condition\IsInstanceOf',
24
        'IsNotNull' => 'Rb\Specification\Doctrine\Condition\IsNotNull',
25
        'IsNull' => 'Rb\Specification\Doctrine\Condition\IsNull',
26
        'LessThan' => 'Rb\Specification\Doctrine\ConditionLessThan',
27
        'LessThanOrEquals' => 'Rb\Specification\Doctrine\Condition\LessThanOrEquals',
28
        'Like' => 'Rb\Specification\Doctrine\Condition\Like',
29
        'NotEquals' => 'Rb\Specification\Doctrine\Condition\NotEquals',
30
        'NotIn' => 'Rb\Specification\Doctrine\Condition\NotIn',
31
32
        'AndX' => 'Rb\Specification\Doctrine\Logic\AndX',
33
        'Not' => 'Rb\Specification\Doctrine\Logic\Not',
34
        'OrX' => 'Rb\Specification\Doctrine\Logic\OrX',
35
36
        'GroupBy' => 'Rb\Specification\Doctrine\Query\GroupBy',
37
        'Having' => 'Rb\Specification\Doctrine\Query\Having',
38
        'IndexBy' => 'Rb\Specification\Doctrine\Query\IndexBy',
39
        'InnerJoin' => 'Rb\Specification\Doctrine\Query\InnerJoin',
40
        'Join' => 'Rb\Specification\Doctrine\Query\Join',
41
        'LeftJoin' => 'Rb\Specification\Doctrine\Query\LeftJoin',
42
        'OrderBy' => 'Rb\Specification\Doctrine\Query\OrderBy',
43
        'Select' => 'Rb\Specification\Doctrine\Query\Select',
44
    ];
45
46
    /**
47
     * @param string $name
48
     * @param array  $arguments
49
     *
50
     * @throws \InvalidArgumentException
51
     *
52
     * @return SpecificationInterface
53
     */
54
    static public function __callStatic($name, $arguments)
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
55
    {
56
        if (!in_array($name, self::$supportedSpecifications)) {
57
            throw new \InvalidArgumentException(
58
                sprintf('Specification %s is not supported', $name)
59
            );
60
        }
61
62
        $reflect = new \ReflectionClass(self::$supportedSpecifications[$name]);
63
64
        return $reflect->newInstanceArgs($arguments);
65
    }
66
}
67