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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 43
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTotalAmountOfItems() 0 3 1
A getAmountOfItemsOnCurrentPage() 0 3 1
A getPaginatedItems() 0 3 1
A updatePaginatedItems() 0 4 1
A __construct() 0 10 1
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