@@ -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/" |
@@ -70,7 +70,7 @@ |
||
70 | 70 | public function setUp(): void |
71 | 71 | { |
72 | 72 | parent::setUp(); |
73 | - $this->resetSingletonInstances = true; |
|
73 | + $this->resetSingletonInstances = TRUE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function testValidation(): void |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | if ($doc !== null) { |
165 | 165 | $this->document->setCurrentDocument($doc); |
166 | 166 | } else { |
167 | - $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"'); |
|
167 | + $this->logger->error('Failed to load document with record ID "'.$this->requestData['recordId'].'"'); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } else { |
171 | - $this->logger->error('Invalid ID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
|
171 | + $this->logger->error('Invalid ID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading'); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | && !MathUtility::canBeInterpretedAsInteger($this->requestData['id']) |
266 | 266 | && !GeneralUtility::isValidUrl($this->requestData['id']) |
267 | 267 | ) { |
268 | - $this->logger->warning('Invalid ID or URI "' . $this->requestData['id'] . '" for document loading'); |
|
268 | + $this->logger->warning('Invalid ID or URI "'.$this->requestData['id'].'" for document loading'); |
|
269 | 269 | unset($this->requestData['id']); |
270 | 270 | } |
271 | 271 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | { |
326 | 326 | if (!array_key_exists($setting, $this->settings) || empty($this->settings[$setting])) { |
327 | 327 | $this->settings[$setting] = $value; |
328 | - $this->logger->warning('Setting "' . $setting . '" not set, using default value "' . $value . '". Probably FlexForm for controller "' . get_class($this) . '" is not read.'); |
|
328 | + $this->logger->warning('Setting "'.$setting.'" not set, using default value "'.$value.'". Probably FlexForm for controller "'.get_class($this).'" is not read.'); |
|
329 | 329 | } else { |
330 | 330 | $this->settings[$setting] = (int) $this->settings[$setting]; |
331 | 331 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $pages = []; |
411 | 411 | $pagesSect = []; |
412 | 412 | $aRange = []; |
413 | - $nRange = 5; // ToDo: should be made configurable |
|
413 | + $nRange = 5; // ToDo: should be made configurable |
|
414 | 414 | |
415 | 415 | // lower limit of the range |
416 | 416 | $nBottom = $currentPageNumber - $nRange; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | |
426 | 426 | // check whether the first screen page is > 1, if yes then points must be added |
427 | 427 | if ($aRange[0] > 1) { |
428 | - array_push($pagesSect, ['label' => '...','startRecordNumber' => '...']); |
|
428 | + array_push($pagesSect, ['label' => '...', 'startRecordNumber' => '...']); |
|
429 | 429 | }; |
430 | 430 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
431 | 431 | foreach (range($firstPage, $lastPage) as $i) { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | // Check if screen page is in range |
470 | 470 | if (in_array($i, $aRange)) { |
471 | - array_push($pagesSect, ['label' => $i,'startRecordNumber' => $startRecordNumber]); |
|
471 | + array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $startRecordNumber]); |
|
472 | 472 | }; |
473 | 473 | }; |
474 | 474 | }; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | // fix for count(): Argument #1 ($value) must be of type Countable|array, null given |
535 | 535 | $this->documentArray[] = $doc; |
536 | 536 | } else { |
537 | - $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
|
537 | + $this->logger->error('Invalid UID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading'); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | return $doc; |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | foreach ($this->requestData['multipleSource'] as $location) { |
573 | 573 | $document = AbstractDocument::getInstance($location, $this->settings, true); |
574 | 574 | if ($document !== null) { |
575 | - $this->documentArray['extra_' . $i] = $document; |
|
575 | + $this->documentArray['extra_'.$i] = $document; |
|
576 | 576 | } |
577 | 577 | $i++; |
578 | 578 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | |
597 | 597 | $this->document->setLocation($documentId); |
598 | 598 | } else { |
599 | - $this->logger->error('Invalid location given "' . $documentId . '" for document loading'); |
|
599 | + $this->logger->error('Invalid location given "'.$documentId.'" for document loading'); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | return $doc; |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @abstract |
38 | 38 | */ |
39 | -abstract class AbstractController extends ActionController implements LoggerAwareInterface |
|
40 | -{ |
|
39 | +abstract class AbstractController extends ActionController implements LoggerAwareInterface { |
|
41 | 40 | use LoggerAwareTrait; |
42 | 41 | |
43 | 42 | /** |
@@ -242,8 +241,7 @@ discard block |
||
242 | 241 | * |
243 | 242 | * @return null|string|array |
244 | 243 | */ |
245 | - protected function getParametersSafely(string $parameterName) |
|
246 | - { |
|
244 | + protected function getParametersSafely(string $parameterName) { |
|
247 | 245 | if ($this->request->hasArgument($parameterName)) { |
248 | 246 | return $this->request->getArgument($parameterName); |
249 | 247 | } |
@@ -388,8 +386,7 @@ discard block |
||
388 | 386 | * |
389 | 387 | * @return void |
390 | 388 | */ |
391 | - public function __construct() |
|
392 | - { |
|
389 | + public function __construct() { |
|
393 | 390 | $this->initialize(); |
394 | 391 | } |
395 | 392 | |
@@ -430,7 +427,8 @@ discard block |
||
430 | 427 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
431 | 428 | foreach (range($firstPage, $lastPage) as $i) { |
432 | 429 | // detect which pagination is active: ListView or GridView |
433 | - if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { // ListView |
|
430 | + if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { |
|
431 | +// ListView |
|
434 | 432 | $lastStartRecordNumberGrid = $i; // save last $startRecordNumber for LastPage button |
435 | 433 | |
436 | 434 | $pages[$i] = [ |
@@ -443,7 +441,8 @@ discard block |
||
443 | 441 | if (in_array($i, $aRange)) { |
444 | 442 | array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $i]); |
445 | 443 | }; |
446 | - } else { // GridView |
|
444 | + } else { |
|
445 | +// GridView |
|
447 | 446 | // to calculate the values for generation the links for the pagination pages |
448 | 447 | /** @var \Kitodo\Dlf\Pagination\PageGridPaginator $paginator */ |
449 | 448 | $itemsPerPage = $paginator->getPublicItemsPerPage(); |
@@ -523,8 +522,7 @@ discard block |
||
523 | 522 | * |
524 | 523 | * @return AbstractDocument |
525 | 524 | */ |
526 | - private function getDocumentByUid(int $documentId) |
|
527 | - { |
|
525 | + private function getDocumentByUid(int $documentId) { |
|
528 | 526 | // TODO: implement multiView as it is in getDocumentByUrl |
529 | 527 | $doc = null; |
530 | 528 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
@@ -549,8 +547,7 @@ discard block |
||
549 | 547 | * |
550 | 548 | * @return AbstractDocument |
551 | 549 | */ |
552 | - protected function getDocumentByUrl(string $documentId) |
|
553 | - { |
|
550 | + protected function getDocumentByUrl(string $documentId) { |
|
554 | 551 | $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
555 | 552 | |
556 | 553 | if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @access protected |
63 | 63 | * @var Document|null This holds the current document |
64 | 64 | */ |
65 | - protected ?Document $document = null; |
|
65 | + protected ?Document $document = NULL; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @access protected |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | // Try to get document format from database |
144 | 144 | if (!empty($documentId)) { |
145 | 145 | |
146 | - $doc = null; |
|
146 | + $doc = NULL; |
|
147 | 147 | |
148 | 148 | if (MathUtility::canBeInterpretedAsInteger($documentId)) { |
149 | 149 | $doc = $this->getDocumentByUid($documentId); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $doc = $this->getDocumentByUrl($documentId); |
152 | 152 | } |
153 | 153 | |
154 | - if ($this->document !== null && $doc !== null) { |
|
154 | + if ($this->document !== NULL && $doc !== NULL) { |
|
155 | 155 | $this->document->setCurrentDocument($doc); |
156 | 156 | } |
157 | 157 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | $this->document = $this->documentRepository->findOneByRecordId($this->requestData['recordId']); |
161 | 161 | |
162 | - if ($this->document !== null) { |
|
163 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
|
164 | - if ($doc !== null) { |
|
162 | + if ($this->document !== NULL) { |
|
163 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE); |
|
164 | + if ($doc !== NULL) { |
|
165 | 165 | $this->document->setCurrentDocument($doc); |
166 | 166 | } else { |
167 | 167 | $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"'); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | protected function isDocMissing(): bool |
220 | 220 | { |
221 | - return $this->document === null || $this->document->getCurrentDocument() === null; |
|
221 | + return $this->document === NULL || $this->document->getCurrentDocument() === NULL; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | if ($this->request->hasArgument($parameterName)) { |
248 | 248 | return $this->request->getArgument($parameterName); |
249 | 249 | } |
250 | - return null; |
|
250 | + return NULL; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | if (isset($this->settings['multiViewType']) && $this->document->getCurrentDocument()->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
369 | 369 | $i = 0; |
370 | 370 | foreach ($this->documentArray as $document) { |
371 | - if ($document !== null) { |
|
371 | + if ($document !== NULL) { |
|
372 | 372 | $this->requestData['docPage'][$i] = MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i], 1, $document->numPages, 1); |
373 | 373 | $i++; |
374 | 374 | } |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | }; |
480 | 480 | |
481 | 481 | // Safely get the next and previous page numbers |
482 | - $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : null; |
|
483 | - $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : null; |
|
482 | + $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : NULL; |
|
483 | + $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : NULL; |
|
484 | 484 | |
485 | 485 | // 'startRecordNumber' is not required in GridView, only the variant for each loop is required |
486 | 486 | // 'endRecordNumber' is not required in both views |
@@ -526,11 +526,11 @@ discard block |
||
526 | 526 | private function getDocumentByUid(int $documentId) |
527 | 527 | { |
528 | 528 | // TODO: implement multiView as it is in getDocumentByUrl |
529 | - $doc = null; |
|
529 | + $doc = NULL; |
|
530 | 530 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
531 | 531 | |
532 | 532 | if ($this->document) { |
533 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
|
533 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE); |
|
534 | 534 | // fix for count(): Argument #1 ($value) must be of type Countable|array, null given |
535 | 535 | $this->documentArray[] = $doc; |
536 | 536 | } else { |
@@ -551,13 +551,13 @@ discard block |
||
551 | 551 | */ |
552 | 552 | protected function getDocumentByUrl(string $documentId) |
553 | 553 | { |
554 | - $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
|
554 | + $doc = AbstractDocument::getInstance($documentId, $this->settings, TRUE); |
|
555 | 555 | |
556 | 556 | if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
557 | 557 | $childDocuments = $doc->tableOfContents[0]['children']; |
558 | 558 | $i = 0; |
559 | 559 | foreach ($childDocuments as $document) { |
560 | - $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, true); |
|
560 | + $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, TRUE); |
|
561 | 561 | if (!isset($this->requestData['docPage'][$i]) && isset(explode('#', $document['points'])[1])) { |
562 | 562 | $initPage = explode('#', $document['points'])[1]; |
563 | 563 | $this->requestData['docPage'][$i] = $initPage; |
@@ -570,21 +570,21 @@ discard block |
||
570 | 570 | if ($this->requestData['multipleSource'] && is_array($this->requestData['multipleSource'])) { |
571 | 571 | $i = 0; |
572 | 572 | foreach ($this->requestData['multipleSource'] as $location) { |
573 | - $document = AbstractDocument::getInstance($location, $this->settings, true); |
|
574 | - if ($document !== null) { |
|
573 | + $document = AbstractDocument::getInstance($location, $this->settings, TRUE); |
|
574 | + if ($document !== NULL) { |
|
575 | 575 | $this->documentArray['extra_' . $i] = $document; |
576 | 576 | } |
577 | 577 | $i++; |
578 | 578 | } |
579 | 579 | } |
580 | 580 | |
581 | - if ($doc !== null) { |
|
581 | + if ($doc !== NULL) { |
|
582 | 582 | $this->document = GeneralUtility::makeInstance(Document::class); |
583 | 583 | |
584 | 584 | if ($doc->recordId) { |
585 | 585 | // find document from repository by recordId |
586 | 586 | $docFromRepository = $this->documentRepository->findOneByRecordId($doc->recordId); |
587 | - if ($docFromRepository !== null) { |
|
587 | + if ($docFromRepository !== NULL) { |
|
588 | 588 | $this->document = $docFromRepository; |
589 | 589 | } |
590 | 590 | } |