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.

AbstractSpecification::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
c 1
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Rb\Specification\Doctrine;
4
5
abstract class AbstractSpecification implements SpecificationInterface
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $field;
11
12
    /**
13
     * @var string|null
14
     */
15
    protected $dqlAlias;
16
17
    /**
18
     * @param string      $field
19
     * @param string|null $dqlAlias
20
     */
21
    public function __construct($field, $dqlAlias = null)
22
    {
23
        $this->field    = $field;
24
        $this->dqlAlias = $dqlAlias;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function isSatisfiedBy($value)
31
    {
32
        return true;
33
    }
34
35
    /**
36
     * Create a formatted string for the given property prefixed with the DQL alias.
37
     *
38
     * @param string $dqlAlias
39
     *
40
     * @return string
41
     */
42
    protected function createPropertyWithAlias($dqlAlias)
43
    {
44
        return $this->createAliasedName($this->field, $dqlAlias);
45
    }
46
47
    /**
48
     * Create a formatted string where the value will be prefixed with DQL alias (if not already present).
49
     *
50
     * @param string $value
51
     * @param string $dqlAlias
52
     *
53
     * @return string
54
     */
55
    protected function createAliasedName($value, $dqlAlias)
56
    {
57
        if (strpos($value, '.') !== false) {
58
            return $value;
59
        }
60
61
        if (! empty($this->dqlAlias)) {
62
            $dqlAlias = $this->dqlAlias;
63
        }
64
65
        return sprintf('%s.%s', $dqlAlias, $value);
66
    }
67
}
68