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.
Passed
Pull Request — master (#168)
by Simone
05:34
created

QueryOptionsBuilder::ensureEntityAliasIsDefined()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Mado\QueryBundle\Queries\Options;
4
5
class QueryOptionsBuilder
6
{
7
    private $entityAlias;
8
9
    public function setEntityAlias(string $entityAlias)
10
    {
11
        $this->entityAlias = $entityAlias;
12
    }
13
14
    public function builderFromRequest(Request $request = null)
0 ignored issues
show
Bug introduced by
The type Mado\QueryBundle\Queries\Options\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
    {
16
        $this->ensureEntityAliasIsDefined();
17
18
        $requestAttributes = [];
19
        foreach ($request->attributes->all() as $attributeName => $attributeValue) {
20
            $requestAttributes[$attributeName] = $request->attributes->get(
21
                $attributeName,
22
                $attributeValue
23
            );
24
        }
25
26
        $filters     = $request->query->get('filtering', []);
27
        $orFilters   = $request->query->get('filtering_or', []);
28
        $sorting     = $request->query->get('sorting', []);
29
        $printing    = $request->query->get('printing', []);
30
        $rel         = $request->query->get('rel', '');
31
        $page        = $request->query->get('page', '');
32
        $select      = $request->query->get('select', $this->getEntityAlias());
0 ignored issues
show
Bug introduced by
The method getEntityAlias() does not exist on Mado\QueryBundle\Queries...ons\QueryOptionsBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        $select      = $request->query->get('select', $this->/** @scrutinizer ignore-call */ getEntityAlias());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
        $filtering   = $request->query->get('filtering', '');
34
        $limit       = $request->query->get('limit', '');
35
36
        $filterOrCorrected = [];
37
38
        $count = 0;
39
        foreach ($orFilters as $key => $filter) {
40
            if (is_array($filter)) {
41
                foreach ($filter as $keyInternal => $internal) {
42
                    $filterOrCorrected[$keyInternal . '|' . $count] = $internal;
43
                    $count += 1;
44
                }
45
            } else {
46
                $filterOrCorrected[$key] = $filter;
47
            }
48
        }
49
50
        $requestProperties = [
51
            'filtering'   => $filtering,
52
            'orFiltering' => $filterOrCorrected,
53
            'limit'       => $limit,
54
            'page'        => $page,
55
            'filters'     => $filters,
56
            'orFilters'   => $filterOrCorrected,
57
            'sorting'     => $sorting,
58
            'rel'         => $rel,
59
            'printing'    => $printing,
60
            'select'      => $select,
61
        ];
62
63
        $options = array_merge(
64
            $requestAttributes,
65
            $requestProperties
66
        );
67
68
        return QueryBuilderOptions::fromArray($options);
0 ignored issues
show
Bug introduced by
The type Mado\QueryBundle\Queries...ons\QueryBuilderOptions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
69
    }
70
71
    public function ensureEntityAliasIsDefined()
72
    {
73
        if (!$this->entityAlias) {
74
            throw new \RuntimeException(
75
                'Oops! Entity alias is missing'
76
            );
77
        }
78
    }
79
}
80