@@ -33,8 +33,7 @@ |
||
| 33 | 33 | * @subpackage dlf |
| 34 | 34 | * @access public |
| 35 | 35 | */ |
| 36 | -class DOMDocumentValidation implements MiddlewareInterface |
|
| 37 | -{ |
|
| 36 | +class DOMDocumentValidation implements MiddlewareInterface { |
|
| 38 | 37 | use LoggerAwareTrait; |
| 39 | 38 | |
| 40 | 39 | /** |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class SaxonXslToSvrlValidatorTest extends UnitTestCase |
|
| 32 | -{ |
|
| 31 | +class SaxonXslToSvrlValidatorTest extends UnitTestCase { |
|
| 33 | 32 | const SVRL = <<<SVRL |
| 34 | 33 | <svrl:schematron-output |
| 35 | 34 | xmlns:svrl="http://purl.oclc.org/dsdl/schematron"> |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | * |
| 30 | 30 | * @access public |
| 31 | 31 | */ |
| 32 | -class DOMDocumentValidationStackTest extends UnitTestCase |
|
| 33 | -{ |
|
| 32 | +class DOMDocumentValidationStackTest extends UnitTestCase { |
|
| 34 | 33 | public function setUp(): void |
| 35 | 34 | { |
| 36 | 35 | parent::setUp(); |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | * |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class XmlSchemesValidatorTest extends UnitTestCase |
|
| 30 | -{ |
|
| 29 | +class XmlSchemesValidatorTest extends UnitTestCase { |
|
| 31 | 30 | const METS = <<<METS |
| 32 | 31 | <mets:mets |
| 33 | 32 | xmlns:mets="http://www.loc.gov/METS/" |
@@ -30,14 +30,12 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @access public |
| 32 | 32 | */ |
| 33 | -class SaxonXslToSvrlValidator extends AbstractDlfValidator implements LoggerAwareInterface |
|
| 34 | -{ |
|
| 33 | +class SaxonXslToSvrlValidator extends AbstractDlfValidator implements LoggerAwareInterface { |
|
| 35 | 34 | private string $jar; |
| 36 | 35 | |
| 37 | 36 | private string $xsl; |
| 38 | 37 | |
| 39 | - public function __construct(array $configuration) |
|
| 40 | - { |
|
| 38 | + public function __construct(array $configuration) { |
|
| 41 | 39 | parent::__construct(DOMDocument::class); |
| 42 | 40 | $this->jar = GeneralUtility::getFileAbsFileName($configuration["jar"] ?? ''); |
| 43 | 41 | $this->xsl = GeneralUtility::getFileAbsFileName($configuration["xsl"] ?? ''); |
@@ -24,14 +24,12 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class XmlSchemesValidator extends AbstractDlfValidator |
|
| 28 | -{ |
|
| 27 | +class XmlSchemesValidator extends AbstractDlfValidator { |
|
| 29 | 28 | use LibXmlTrait; |
| 30 | 29 | |
| 31 | 30 | private array $schemes; |
| 32 | 31 | |
| 33 | - public function __construct(array $configuration) |
|
| 34 | - { |
|
| 32 | + public function __construct(array $configuration) { |
|
| 35 | 33 | parent::__construct(DOMDocument::class); |
| 36 | 34 | $this->schemes = $configuration; |
| 37 | 35 | } |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @access public |
| 31 | 31 | */ |
| 32 | -abstract class AbstractDlfValidator extends AbstractValidator |
|
| 33 | -{ |
|
| 32 | +abstract class AbstractDlfValidator extends AbstractValidator { |
|
| 34 | 33 | use LoggerAwareTrait; |
| 35 | 34 | |
| 36 | 35 | protected string $valueClassName; |
@@ -38,8 +37,7 @@ discard block |
||
| 38 | 37 | /** |
| 39 | 38 | * @param $valueClassName string The class name of the value |
| 40 | 39 | */ |
| 41 | - public function __construct(string $valueClassName) |
|
| 42 | - { |
|
| 40 | + public function __construct(string $valueClassName) { |
|
| 43 | 41 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 44 | 42 | $this->valueClassName = $valueClassName; |
| 45 | 43 | } |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @abstract |
| 41 | 41 | */ |
| 42 | -abstract class AbstractController extends ActionController implements LoggerAwareInterface |
|
| 43 | -{ |
|
| 42 | +abstract class AbstractController extends ActionController implements LoggerAwareInterface { |
|
| 44 | 43 | use LoggerAwareTrait; |
| 45 | 44 | |
| 46 | 45 | /** |
@@ -248,8 +247,7 @@ discard block |
||
| 248 | 247 | * |
| 249 | 248 | * @return null|string|array |
| 250 | 249 | */ |
| 251 | - protected function getParametersSafely(string $parameterName) |
|
| 252 | - { |
|
| 250 | + protected function getParametersSafely(string $parameterName) { |
|
| 253 | 251 | if ($this->request->hasArgument($parameterName)) { |
| 254 | 252 | return $this->request->getArgument($parameterName); |
| 255 | 253 | } |
@@ -444,7 +442,8 @@ discard block |
||
| 444 | 442 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
| 445 | 443 | foreach (range($firstPage, $lastPage) as $i) { |
| 446 | 444 | // detect which pagination is active: ListView or GridView |
| 447 | - if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { // ListView |
|
| 445 | + if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { |
|
| 446 | +// ListView |
|
| 448 | 447 | $lastStartRecordNumberGrid = $i; // save last $startRecordNumber for LastPage button |
| 449 | 448 | |
| 450 | 449 | $pages[$i] = [ |
@@ -457,7 +456,8 @@ discard block |
||
| 457 | 456 | if (in_array($i, $aRange)) { |
| 458 | 457 | array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $i]); |
| 459 | 458 | }; |
| 460 | - } else { // GridView |
|
| 459 | + } else { |
|
| 460 | +// GridView |
|
| 461 | 461 | // to calculate the values for generation the links for the pagination pages |
| 462 | 462 | /** @var \Kitodo\Dlf\Pagination\PageGridPaginator $paginator */ |
| 463 | 463 | $itemsPerPage = $paginator->getPublicItemsPerPage(); |
@@ -537,8 +537,7 @@ discard block |
||
| 537 | 537 | * |
| 538 | 538 | * @return AbstractDocument |
| 539 | 539 | */ |
| 540 | - private function getDocumentByUid(int $documentId) |
|
| 541 | - { |
|
| 540 | + private function getDocumentByUid(int $documentId) { |
|
| 542 | 541 | // TODO: implement multiView as it is in getDocumentByUrl |
| 543 | 542 | $doc = null; |
| 544 | 543 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
@@ -563,8 +562,7 @@ discard block |
||
| 563 | 562 | * |
| 564 | 563 | * @return AbstractDocument |
| 565 | 564 | */ |
| 566 | - protected function getDocumentByUrl(string $documentId) |
|
| 567 | - { |
|
| 565 | + protected function getDocumentByUrl(string $documentId) { |
|
| 568 | 566 | $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
| 569 | 567 | |
| 570 | 568 | if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class OaiPmhController extends AbstractController |
|
| 31 | -{ |
|
| 30 | +class OaiPmhController extends AbstractController { |
|
| 32 | 31 | /** |
| 33 | 32 | * @access protected |
| 34 | 33 | * @var TokenRepository |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | * |
| 43 | 42 | * @return void |
| 44 | 43 | */ |
| 45 | - public function injectTokenRepository(TokenRepository $tokenRepository) |
|
| 46 | - { |
|
| 44 | + public function injectTokenRepository(TokenRepository $tokenRepository) { |
|
| 47 | 45 | $this->tokenRepository = $tokenRepository; |
| 48 | 46 | } |
| 49 | 47 | |
@@ -60,8 +58,7 @@ discard block |
||
| 60 | 58 | * |
| 61 | 59 | * @return void |
| 62 | 60 | */ |
| 63 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
| 64 | - { |
|
| 61 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
| 65 | 62 | $this->collectionRepository = $collectionRepository; |
| 66 | 63 | } |
| 67 | 64 | |
@@ -78,8 +75,7 @@ discard block |
||
| 78 | 75 | * |
| 79 | 76 | * @return void |
| 80 | 77 | */ |
| 81 | - public function injectLibraryRepository(LibraryRepository $libraryRepository) |
|
| 82 | - { |
|
| 78 | + public function injectLibraryRepository(LibraryRepository $libraryRepository) { |
|
| 83 | 79 | $this->libraryRepository = $libraryRepository; |
| 84 | 80 | } |
| 85 | 81 | |
@@ -90,8 +86,7 @@ discard block |
||
| 90 | 86 | * |
| 91 | 87 | * @return void |
| 92 | 88 | */ |
| 93 | - public function initializeAction() |
|
| 94 | - { |
|
| 89 | + public function initializeAction() { |
|
| 95 | 90 | $this->request = $this->request->withFormat("xml"); |
| 96 | 91 | } |
| 97 | 92 | |
@@ -136,8 +131,7 @@ discard block |
||
| 136 | 131 | * |
| 137 | 132 | * @return void |
| 138 | 133 | */ |
| 139 | - protected function deleteExpiredTokens() |
|
| 140 | - { |
|
| 134 | + protected function deleteExpiredTokens() { |
|
| 141 | 135 | // Delete expired resumption tokens. |
| 142 | 136 | $this->tokenRepository->deleteExpiredTokens($this->settings['expired']); |
| 143 | 137 | } |
@@ -149,8 +143,7 @@ discard block |
||
| 149 | 143 | * |
| 150 | 144 | * @return void |
| 151 | 145 | */ |
| 152 | - protected function getUrlParams() |
|
| 153 | - { |
|
| 146 | + protected function getUrlParams() { |
|
| 154 | 147 | $allowedParams = [ |
| 155 | 148 | 'verb', |
| 156 | 149 | 'identifier', |
@@ -181,8 +174,7 @@ discard block |
||
| 181 | 174 | * |
| 182 | 175 | * @return array The mapped metadata array |
| 183 | 176 | */ |
| 184 | - private function getDublinCoreData(array $record) |
|
| 185 | - { |
|
| 177 | + private function getDublinCoreData(array $record) { |
|
| 186 | 178 | $metadata = []; |
| 187 | 179 | |
| 188 | 180 | $metadata[] = ['dc:identifier' => $record['record_id']]; |
@@ -224,8 +216,7 @@ discard block |
||
| 224 | 216 | * |
| 225 | 217 | * @return void |
| 226 | 218 | */ |
| 227 | - private function addDublinCoreData(&$metadata, $key, $value) |
|
| 228 | - { |
|
| 219 | + private function addDublinCoreData(&$metadata, $key, $value) { |
|
| 229 | 220 | if (!empty($value)) { |
| 230 | 221 | $metadata[] = [$key => $value]; |
| 231 | 222 | } |
@@ -241,8 +232,7 @@ discard block |
||
| 241 | 232 | * |
| 242 | 233 | * @return string The fetched METS XML |
| 243 | 234 | */ |
| 244 | - protected function getMetsData(array $record) |
|
| 245 | - { |
|
| 235 | + protected function getMetsData(array $record) { |
|
| 246 | 236 | $mets = null; |
| 247 | 237 | // Load METS file. |
| 248 | 238 | $xml = new \DOMDocument(); |
@@ -335,8 +325,7 @@ discard block |
||
| 335 | 325 | * |
| 336 | 326 | * @return void |
| 337 | 327 | */ |
| 338 | - protected function verbGetRecord() |
|
| 339 | - { |
|
| 328 | + protected function verbGetRecord() { |
|
| 340 | 329 | if (count($this->parameters) !== 3 || empty($this->parameters['metadataPrefix']) || empty($this->parameters['identifier'])) { |
| 341 | 330 | $this->error = 'badArgument'; |
| 342 | 331 | return; |
@@ -388,8 +377,7 @@ discard block |
||
| 388 | 377 | * |
| 389 | 378 | * @return void |
| 390 | 379 | */ |
| 391 | - protected function verbIdentify() |
|
| 392 | - { |
|
| 380 | + protected function verbIdentify() { |
|
| 393 | 381 | $library = $this->libraryRepository->findByUid($this->settings['library']); |
| 394 | 382 | |
| 395 | 383 | $oaiIdentifyInfo = []; |
@@ -438,8 +426,7 @@ discard block |
||
| 438 | 426 | * |
| 439 | 427 | * @return void |
| 440 | 428 | */ |
| 441 | - protected function verbListIdentifiers() |
|
| 442 | - { |
|
| 429 | + protected function verbListIdentifiers() { |
|
| 443 | 430 | // If we have a resumption token we can continue our work |
| 444 | 431 | if (!empty($this->parameters['resumptionToken'])) { |
| 445 | 432 | // "resumptionToken" is an exclusive argument. |
@@ -493,8 +480,7 @@ discard block |
||
| 493 | 480 | * |
| 494 | 481 | * @return void |
| 495 | 482 | */ |
| 496 | - protected function verbListMetadataFormats() |
|
| 497 | - { |
|
| 483 | + protected function verbListMetadataFormats() { |
|
| 498 | 484 | $resArray = []; |
| 499 | 485 | // check for the optional "identifier" parameter |
| 500 | 486 | if (isset($this->parameters['identifier'])) { |
@@ -526,8 +512,7 @@ discard block |
||
| 526 | 512 | * |
| 527 | 513 | * @return void |
| 528 | 514 | */ |
| 529 | - protected function verbListRecords() |
|
| 530 | - { |
|
| 515 | + protected function verbListRecords() { |
|
| 531 | 516 | // Check for invalid arguments. |
| 532 | 517 | if (!empty($this->parameters['resumptionToken'])) { |
| 533 | 518 | // "resumptionToken" is an exclusive argument. |
@@ -582,8 +567,7 @@ discard block |
||
| 582 | 567 | * |
| 583 | 568 | * @return void |
| 584 | 569 | */ |
| 585 | - protected function verbListSets() |
|
| 586 | - { |
|
| 570 | + protected function verbListSets() { |
|
| 587 | 571 | // It is required to set a oai_name inside the collection record to be shown in oai-pmh plugin. |
| 588 | 572 | $this->settings['hideEmptyOaiNames'] = true; |
| 589 | 573 | |
@@ -729,8 +713,7 @@ discard block |
||
| 729 | 713 | * |
| 730 | 714 | * @return array|false |
| 731 | 715 | */ |
| 732 | - private function getDate(string $dateType) |
|
| 733 | - { |
|
| 716 | + private function getDate(string $dateType) { |
|
| 734 | 717 | return strptime($this->parameters[$dateType], '%Y-%m-%dT%H:%M:%SZ') ?: strptime($this->parameters[$dateType], '%Y-%m-%d'); |
| 735 | 718 | } |
| 736 | 719 | |
@@ -785,8 +768,7 @@ discard block |
||
| 785 | 768 | * |
| 786 | 769 | * @return array of enriched records |
| 787 | 770 | */ |
| 788 | - protected function generateOutputForDocumentList(array $documentListSet) |
|
| 789 | - { |
|
| 771 | + protected function generateOutputForDocumentList(array $documentListSet) { |
|
| 790 | 772 | // check whether any result elements are available |
| 791 | 773 | if (empty($documentListSet) || empty($documentListSet['elements'])) { |
| 792 | 774 | $this->error = 'noRecordsMatch'; |
@@ -841,8 +823,7 @@ discard block |
||
| 841 | 823 | * |
| 842 | 824 | * @return void |
| 843 | 825 | */ |
| 844 | - protected function generateResumptionTokenForDocumentListSet(array $documentListSet, int $numShownDocuments) |
|
| 845 | - { |
|
| 826 | + protected function generateResumptionTokenForDocumentListSet(array $documentListSet, int $numShownDocuments) { |
|
| 846 | 827 | // The cursor specifies how many elements have already been returned in previous requests |
| 847 | 828 | // See http://www.openarchives.org/OAI/openarchivesprotocol.html#FlowControl |
| 848 | 829 | $currentCursor = $documentListSet['metadata']['cursor']; |