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.

Issues (210)

Classes/Controller/PageGridController.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
4
 *
5
 * This file is part of the Kitodo and TYPO3 projects.
6
 *
7
 * @license GNU General Public License version 3 or later.
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace Kitodo\Dlf\Controller;
13
14
use Kitodo\Dlf\Pagination\PageGridPagination;
15
use Kitodo\Dlf\Pagination\PageGridPaginator;
16
use Psr\Http\Message\ResponseInterface;
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19
/**
20
 * Controller class for the plugin 'Page Grid'.
21
 *
22
 * @package TYPO3
23
 * @subpackage dlf
24
 *
25
 * @access public
26
 */
27
class PageGridController extends AbstractController
28
{
29
    /**
30
     * The main method of the plugin
31
     *
32
     * @access public
33
     *
34
     * @return ResponseInterface the response
35
     */
36
    public function mainAction(): ResponseInterface
37
    {
38
        $this->loadDocument();
39
        if (
40
            $this->isDocMissingOrEmpty()
41
            || empty($this->extConf['files']['fileGrpThumbs'])
42
        ) {
43
            // Quit without doing anything if required variables are not set.
44
            return $this->htmlResponse();
45
        }
46
47
        $entryArray = [];
48
49
        $numPages = $this->document->getCurrentDocument()->numPages;
50
        // Iterate through visible page set and display thumbnails.
51
        for ($i = 1; $i <= $numPages; $i++) {
52
            $foundEntry = $this->getEntry($i, $this->extConf['files']['fileGrpThumbs']);
53
            $foundEntry['state'] = ($i == $this->requestData['page']) ? 'cur' : 'no';
54
            $entryArray[] = $foundEntry;
55
        }
56
57
        // Get current page from request data because the parameter is shared between plugins
58
        $currentPage = $this->requestData['page'] ?? 1;
59
60
        $itemsPerPage = $this->settings['paginate']['itemsPerPage'];
61
        if (empty($itemsPerPage)) {
62
            $itemsPerPage = 25;
63
        }
64
65
        $pageGridPaginator = new PageGridPaginator($entryArray, $currentPage, $itemsPerPage);
66
        $pageGridPagination = new PageGridPagination($pageGridPaginator);
67
68
        $pagination = $this->buildSimplePagination($pageGridPagination, $pageGridPaginator);
69
        $this->view->assignMultiple([ 'pagination' => $pagination, 'paginator' => $pageGridPaginator ]);
70
71
        $this->view->assign('docUid', $this->requestData['id']);
72
73
        return $this->htmlResponse();
74
    }
75
76
    /**
77
     * Renders entry for one page of the current document.
78
     *
79
     * @access protected
80
     *
81
     * @param int $number The page to render
82
     * @param string $fileGrpThumbs the file group(s) of thumbs
83
     *
84
     * @return array The rendered entry ready for fluid
85
     */
86
    protected function getEntry(int $number, string $fileGrpThumbs): array
87
    {
88
        // Set pagination.
89
        $entry['pagination'] = htmlspecialchars($this->document->getCurrentDocument()->physicalStructureInfo[$this->document->getCurrentDocument()->physicalStructure[$number]]['orderlabel']);
0 ignored issues
show
The method getCurrentDocument() does not exist on null. ( Ignorable by Annotation )

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

89
        $entry['pagination'] = htmlspecialchars($this->document->/** @scrutinizer ignore-call */ getCurrentDocument()->physicalStructureInfo[$this->document->getCurrentDocument()->physicalStructure[$number]]['orderlabel']);

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...
90
        $entry['page'] = $number;
91
        $entry['thumbnail'] = '';
92
93
        // Get thumbnail or placeholder.
94
        $fileGrpsThumb = GeneralUtility::trimExplode(',', $fileGrpThumbs);
95
        if (is_array($this->document->getCurrentDocument()->physicalStructureInfo[$this->document->getCurrentDocument()->physicalStructure[$number]]['files'])) {
96
            if (array_intersect($fileGrpsThumb, array_keys($this->document->getCurrentDocument()->physicalStructureInfo[$this->document->getCurrentDocument()->physicalStructure[$number]]['files'])) !== []) {
97
                while ($fileGrpThumb = array_shift($fileGrpsThumb)) {
98
                    if (!empty($this->document->getCurrentDocument()->physicalStructureInfo[$this->document->getCurrentDocument()->physicalStructure[$number]]['files'][$fileGrpThumb])) {
99
                        $entry['thumbnail'] = $this->document->getCurrentDocument()->getFileLocation($this->document->getCurrentDocument()->physicalStructureInfo[$this->document->getCurrentDocument()->physicalStructure[$number]]['files'][$fileGrpThumb]);
100
                        break;
101
                    }
102
                }
103
            }
104
        }
105
        return $entry;
106
    }
107
}
108