diff --git a/Build/phpstan.neon b/Build/phpstan.neon index 298c80c12..cc37a8087 100644 --- a/Build/phpstan.neon +++ b/Build/phpstan.neon @@ -1,7 +1,6 @@ parameters: ignoreErrors: - '#Call to an undefined method Kitodo\\Dlf\\Domain\\Model\\Document::getCurrentDocument\(\)\.#' - - '#Parameter \#1 \$documentId of method Kitodo\\Dlf\\Controller\\AbstractController::loadDocument\(\) expects int, array given\.#' level: 5 paths: - ../Classes/ diff --git a/Classes/Controller/SruController.php b/Classes/Controller/SruController.php index 06317a058..a0dba70cc 100644 --- a/Classes/Controller/SruController.php +++ b/Classes/Controller/SruController.php @@ -2,10 +2,8 @@ namespace Slub\Dfgviewer\Controller; -use Kitodo\Dlf\Domain\Model\Document; use Kitodo\Dlf\Common\MetsDocument; -use Kitodo\Dlf\Domain\Repository\StructureRepository; -use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -14,22 +12,27 @@ * Checks if the METS document contains a link to an SRU endpoint, and if so, * adds a search form to the pageview. * - * @package TYPO3 - * @subpackage tx_dfgviewer - * @access public + * @package TYPO3 + * @subpackage tx_dfgviewer + * @access public */ class SruController extends \Kitodo\Dlf\Controller\AbstractController { + /** + * The main method of the controller + * + * @return void + */ public function mainAction() { // Load current document. - $this->loadDocument($this->requestData); + $this->loadDocument(); if ( $this->isDocMissing() || !$this->document->getCurrentDocument() instanceof MetsDocument ) { // Quit without doing anything if required variables are not set. - return ''; + return; } // Get digital provenance information. @@ -45,8 +48,8 @@ public function mainAction() } if (empty($sruLink)) { - // Quit without doing anything if required variables are not set. - return ''; + // Quit without doing anything if link is not set. + return; } $actionUrl = $this->uriBuilder->reset() @@ -81,7 +84,7 @@ protected function addSruResultsJS() } $javascriptFooter .= '})'; - $pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addJsFooterInlineCode('tx-dfgviewer-footer', $javascriptFooter); } }