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
Pull Request — master (#885)
by
unknown
08:26
created

SolrPaginator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Common;
14
15
use TYPO3\CMS\Core\Pagination\AbstractPaginator;
16
17
class SolrPaginator extends AbstractPaginator
18
{
19
    /**
20
     * @var SolrSearch
21
     */
22
    private $solrSearch;
23
24
    /**
25
     * @var array
26
     */
27
    private $paginatedItems = [];
28
29
    public function __construct(
30
        SolrSearch $solrSearch,
31
        int $currentPageNumber = 1,
32
        int $itemsPerPage = 25
33
    ) {
34
        $this->solrSearch = $solrSearch;
35
        $this->setCurrentPageNumber($currentPageNumber);
36
        $this->setItemsPerPage($itemsPerPage);
37
38
        $this->updateInternalState();
39
    }
40
41
    protected function updatePaginatedItems(int $itemsPerPage, int $offset): void
42
    {
43
        $this->solrSearch->submit($offset, $itemsPerPage);
44
        $this->paginatedItems = $this->solrSearch->toArray();
45
    }
46
47
    protected function getTotalAmountOfItems(): int
48
    {
49
        return $this->solrSearch->count();
50
    }
51
52
    protected function getAmountOfItemsOnCurrentPage(): int
53
    {
54
        return count($this->paginatedItems);
55
    }
56
57
    public function getPaginatedItems(): iterable
58
    {
59
        return $this->paginatedItems;
60
    }
61
}
62