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 (#715)
by Alexander
02:40
created

NavigationController   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 11
eloc 39
c 2
b 0
f 0
dl 0
loc 68
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B mainAction() 0 61 11
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\Common\Helper;
15
use TYPO3\CMS\Core\Utility\GeneralUtility;
16
use TYPO3\CMS\Core\Utility\MathUtility;
17
18
class NavigationController extends AbstractController
19
{
20
    /**
21
     * The main method of the plugin
22
     *
23
     * @return void
24
     */
25
    public function mainAction()
26
    {
27
        $requestData = GeneralUtility::_GPmerged('tx_dlf');
28
        unset($requestData['__referrer'], $requestData['__trustedProperties']);
29
30
        if (empty($requestData['id'])) {
31
            return '';
0 ignored issues
show
Bug Best Practice introduced by
The expression return '' returns the type string which is incompatible with the documented return type void.
Loading history...
32
        }
33
        if (empty($requestData['page'])) {
34
            $requestData['page'] = 1;
35
        }
36
        // Load current document.
37
        $this->loadDocument($requestData);
38
        if ($this->doc === null) {
39
            // Quit without doing anything if required variables are not set.
40
            return '';
0 ignored issues
show
Bug Best Practice introduced by
The expression return '' returns the type string which is incompatible with the documented return type void.
Loading history...
41
        } else {
42
            // Set default values if not set.
43
            if ($this->doc->numPages > 0) {
44
                if (!empty($requestData['logicalPage'])) {
45
                    $requestData['page'] = $this->doc->getPhysicalPage($requestData['logicalPage']);
46
                    // The logical page parameter should not appear
47
                    unset($requestData['logicalPage']);
48
                }
49
                // Set default values if not set.
50
                // $requestData['page'] may be integer or string (physical structure @ID)
51
                if (
52
                    (int) $requestData['page'] > 0
53
                    || empty($requestData['page'])
54
                ) {
55
                    $requestData['page'] = MathUtility::forceIntegerInRange((int) $requestData['page'], 1, $this->doc->numPages, 1);
56
                } else {
57
                    $requestData['page'] = array_search($requestData['page'], $this->doc->physicalStructure);
58
                }
59
                $requestData['double'] = MathUtility::forceIntegerInRange($requestData['double'], 0, 1, 0);
60
            } else {
61
                $requestData['page'] = 0;
62
                $requestData['double'] = 0;
63
            }
64
        }
65
66
        // Steps for X pages backward / forward. Double page view uses double steps.
67
        $pageSteps = $this->settings['pageStep'] * ($requestData['double'] + 1);
68
69
        $this->view->assign('page', $requestData['page']);
70
        $this->view->assign('docId', $this->doc->uid);
71
        $this->view->assign('pageId', $GLOBALS['TSFE']->id);
72
        $this->view->assign('pageSteps', $pageSteps);
73
        $this->view->assign('double', $requestData['double']);
74
        $this->view->assign('numPages', $this->doc->numPages);
75
76
        // TODO: Check if f:link.action can be used in template Navigation->main
77
        $this->view->assign('pageToList', $this->settings['targetPid']);
78
        $this->view->assign('forceAbsoluteUrl', !empty($this->conf['settings.forceAbsoluteUrl']) ? 1 : 0);
79
80
        $pageOptions = [];
81
        for ($i = 1; $i <= $this->doc->numPages; $i++) {
82
            $pageOptions[$i] = ($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - ' . htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '');
83
        }
84
        $this->view->assign('uniqueId', uniqid(Helper::getUnqualifiedClassName(get_class($this)) . '-'));
85
        $this->view->assign('pageOptions', $pageOptions);
86
87
    }
88
}
89