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 ( a11bd1...3fc1f5 )
by Anderson
02:01
created

ElasticQuery::setFirstResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace DoctrineElastic\Elastic;
4
5
use DoctrineElastic\ElasticEntityManager;
6
use DoctrineElastic\Query\QueryParser;
7
use DoctrineElastic\Query\ElasticQueryExecutor;
8
9
/**
10
 * DoctrineElastic Query representation
11
 *
12
 * @author Ands
13
 */
14
class ElasticQuery {
15
16
    /** @var ElasticEntityManager */
17
    protected $entityManager;
18
19
    /** @var ElasticQueryExecutor */
20
    protected $queryExecutor;
21
22
    /** @var int */
23
    protected $_firstResult;
24
25
    /** @var int */
26
    protected $_maxResults;
27
28
    /** @var string */
29
    protected $_dql;
30
31
    /** @var array */
32
    protected $_parameters;
33
34
    public function __construct(ElasticEntityManager $entityManager) {
35
        $this->entityManager = $entityManager;
36
        $this->queryExecutor = new ElasticQueryExecutor($entityManager);
37
    }
38
39
    public function getResult() {
40
        $parser = new QueryParser($this);
41
        $searchParams = $parser->parseElasticQuery();
42
43
        return $this->queryExecutor->execute($searchParams, $parser->getRootClass());
44
    }
45
46
    public function getDQL() {
47
        return $this->_dql;
48
    }
49
50
    public function setDQL($dql) {
51
        $this->_dql = $dql;
52
    }
53
54
    protected function processParameterMappings($paramMappings) {
0 ignored issues
show
Unused Code introduced by
The parameter $paramMappings is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
56
    }
57
58
    /**
59
     * @return mixed
60
     */
61
    public function getParameters() {
62
        return $this->_parameters;
63
    }
64
65
    /**
66
     * @param mixed $parameters
67
     * @return ElasticQuery
68
     */
69
    public function setParameters($parameters) {
70
        $this->_parameters = $parameters;
0 ignored issues
show
Documentation Bug introduced by
It seems like $parameters of type * is incompatible with the declared type array of property $_parameters.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
71
        return $this;
72
    }
73
74
    public function setFirstResult($offset) {
75
        $this->_firstResult = $offset;
76
        return $this;
77
    }
78
79
    public function setMaxResults($limit) {
80
        $this->_maxResults = $limit;
81
        return $this;
82
    }
83
84
    public function getFirstResult() {
85
        return $this->_firstResult;
86
    }
87
88
    public function getMaxResults() {
89
        return $this->_maxResults;
90
    }
91
92
    public function getEntityManager() {
93
        return $this->entityManager;
94
    }
95
96
    public function getOneOrNullResult() {
97
        $results = $this->getResult();
98
99
        return count($results) ? reset($results) : null;
100
    }
101
102
    public function getSingleResult() {
103
        return $this->getOneOrNullResult();
104
    }
105
}