Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

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
Push — master ( af0744...7258dc )
by
unknown
05:55
created

SolrSearchQuery::lessThan()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Kitodo\Dlf\Common\Solr;
4
5
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
6
use TYPO3\CMS\Extbase\Persistence\Generic\Query;
7
8
/**
9
 * Targeted towards being used in ``PaginateController`` (``<f:widget.paginate>``).
10
 *
11
 * @package TYPO3
12
 * @subpackage dlf
13
 *
14
 * @access public
15
 *
16
 * @property int $limit
17
 * @property int $offset
18
 */
19
class SolrSearchQuery extends Query
20
{
21
    /**
22
     * @access private
23
     * @var SolrSearch
24
     */
25
    private SolrSearch $solrSearch;
26
27
    /**
28
     * Constructs SolrSearchQuery instance.
29
     *
30
     * @access public
31
     *
32
     * @param SolrSearch $solrSearch
33
     *
34
     * @return void
35
     */
36
    public function __construct($solrSearch)
37
    {
38
        $this->solrSearch = $solrSearch;
39
40
        $this->offset = 0;
41
        $this->limit = count($solrSearch);
42
    }
43
44
    /**
45
     * Executes SOLR search query.
46
     *
47
     * @access public
48
     *
49
     * @param bool $returnRawQueryResult
50
     *
51
     * @return array
52
     */
53
    // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable<object>&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute()
54
    // @phpstan-ignore-next-line
55
    public function execute($returnRawQueryResult = false)
56
    {
57
        $this->solrSearch->submit($this->offset, $this->limit);
58
59
        // solrSearch now only contains the results in range, indexed in [0, n)
60
        $result = [];
61
        $limit = min($this->limit, $this->solrSearch->getNumLoadedDocuments());
62
        for ($i = 0; $i < $limit; $i++) {
63
            $result[] = $this->solrSearch[$i];
64
        }
65
        return $result;
66
    }
67
68
    /**
69
     * Sets limit for SOLR search query.
70
     *
71
     * @access public
72
     *
73
     * @param int $limit
74
     *
75
     * @return SolrSearchQuery
76
     */
77
    public function setLimit($limit): SolrSearchQuery
78
    {
79
        $this->limit = $limit;
80
        return $this;
81
    }
82
83
    /**
84
     * Sets offset for SOLR search query.
85
     *
86
     * @access public
87
     *
88
     * @param int $offset
89
     *
90
     * @return SolrSearchQuery
91
     */
92
    public function setOffset($offset): SolrSearchQuery
93
    {
94
        $this->offset = $offset;
95
        return $this;
96
    }
97
98
    /**
99
     * Gets limit for SOLR search query.
100
     *
101
     * @access public
102
     *
103
     * @return int
104
     */
105
    public function getLimit(): int
106
    {
107
        return $this->limit;
108
    }
109
110
    /**
111
     * Gets offset for SOLR search query.
112
     *
113
     * @access public
114
     *
115
     * @return int
116
     */
117
    public function getOffset(): int
118
    {
119
        return $this->offset;
120
    }
121
122
}
123