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.
Completed
Push — dev-extbase-fluid ( 5837d7...fc9799 )
by Alexander
02:57 queued 02:54
created

AbstractController::getLanguageService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Document;
15
use Kitodo\Dlf\Common\Helper;
16
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
17
use Psr\Log\LoggerAwareInterface;
18
use Psr\Log\LoggerAwareTrait;
19
use TYPO3\CMS\Core\Database\ConnectionPool;
20
use TYPO3\CMS\Core\Localization\LanguageService;
21
use TYPO3\CMS\Core\Utility\GeneralUtility;
22
23
24
/**
25
 *
26
 */
27
abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController implements LoggerAwareInterface
28
{
29
    use LoggerAwareTrait;
30
31
    public $prefixId = 'tx_dlf';
32
33
    /**
34
     * @var DocumentRepository
35
     */
36
    protected $documentRepository;
37
38
    /**
39
     * @param DocumentRepository $documentRepository
40
     */
41
    public function injectDocumentRepository(DocumentRepository $documentRepository)
42
    {
43
        $this->documentRepository = $documentRepository;
44
    }
45
46
    /**
47
     * @var
48
     */
49
    protected $extConf;
50
51
    /**
52
     * This holds the current document
53
     *
54
     * @var \Kitodo\Dlf\Common\Document
55
     * @access protected
56
     */
57
    protected $doc;
58
59
    /**
60
     * Loads the current document into $this->doc
61
     *
62
     * @access protected
63
     *
64
     * @param array $requestData: The request data
65
     *
66
     * @return void
67
     */
68
    protected function loadDocument($requestData)
69
    {
70
        // Check for required variable.
71
        if (!empty($requestData['id'])) {
72
            // Get instance of \Kitodo\Dlf\Common\Document.
73
            $this->doc = Document::getInstance($requestData['id'], $this->settings);
74
            if (!$this->doc->ready) {
75
                // Destroy the incomplete object.
76
                $this->doc = null;
77
                $this->logger->error('Failed to load document with UID ' . $requestData['id']);
78
            } else {
79
                // Set configuration PID.
80
                $this->doc->cPid = $this->settings['pages'];
81
            }
82
        } elseif (!empty($requestData['recordId'])) {
83
            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
84
                ->getQueryBuilderForTable('tx_dlf_documents');
85
86
            // Get UID of document with given record identifier.
87
            $result = $queryBuilder
88
                ->select('tx_dlf_documents.uid AS uid')
89
                ->from('tx_dlf_documents')
90
                ->where(
91
                    $queryBuilder->expr()->eq('tx_dlf_documents.record_id', $queryBuilder->expr()->literal($requestData['recordId'])),
92
                    Helper::whereExpression('tx_dlf_documents')
93
                )
94
                ->setMaxResults(1)
95
                ->execute();
96
97
            if ($resArray = $result->fetch()) {
98
                $requestData['id'] = $resArray['uid'];
99
                // Set superglobal $_GET array and unset variables to avoid infinite looping.
100
                $_GET[$this->prefixId]['id'] = $requestData['id'];
101
                unset($requestData['recordId'], $_GET[$this->prefixId]['recordId']);
102
                // Try to load document.
103
                $this->loadDocument($requestData);
104
            } else {
105
                $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"');
106
            }
107
        } else {
108
            $this->logger->error('Invalid UID ' . $requestData['id'] . ' or PID ' . $this->settings['pages'] . ' for document loading');
109
        }
110
    }
111
112
    /**
113
     * Returns the LanguageService
114
     *
115
     * @return LanguageService
116
     */
117
    protected function getLanguageService(): LanguageService
118
    {
119
        return $GLOBALS['LANG'];
120
    }
121
122
}
123