@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | foreach ($configuration as $configurationItem) { |
| 56 | 56 | if (!class_exists($configurationItem["className"])) { |
| 57 | - $this->logger->error('Unable to load class ' . $configurationItem["className"] . '.'); |
|
| 57 | + $this->logger->error('Unable to load class '.$configurationItem["className"].'.'); |
|
| 58 | 58 | throw new InvalidArgumentException('Unable to load validator class.', 1723200537037); |
| 59 | 59 | } |
| 60 | 60 | $breakOnError = !isset($configurationItem["breakOnError"]) || $configurationItem["breakOnError"] !== "false"; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (!$validator instanceof AbstractDlfValidator) { |
| 86 | - $this->logger->error($className . ' must be an instance of AbstractDlfValidator.'); |
|
| 86 | + $this->logger->error($className.' must be an instance of AbstractDlfValidator.'); |
|
| 87 | 87 | throw new InvalidArgumentException('Class must be an instance of AbstractDlfValidator.', 1723121212747); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | protected function isValid($value): void |
| 105 | 105 | { |
| 106 | 106 | if (!$value instanceof $this->valueClassName) { |
| 107 | - $this->logger->error('Value must be an instance of ' . $this->valueClassName . '.'); |
|
| 107 | + $this->logger->error('Value must be an instance of '.$this->valueClassName.'.'); |
|
| 108 | 108 | throw new InvalidArgumentException('Type of value is not valid.', 1723127564821); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -abstract class AbstractDlfValidationStack extends AbstractDlfValidator |
|
| 30 | -{ |
|
| 29 | +abstract class AbstractDlfValidationStack extends AbstractDlfValidator { |
|
| 31 | 30 | use LoggerAwareTrait; |
| 32 | 31 | |
| 33 | 32 | const ITEM_KEY_TITLE = "title"; |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | |
| 37 | 36 | protected array $validatorStack = []; |
| 38 | 37 | |
| 39 | - public function __construct(string $valueClassName) |
|
| 40 | - { |
|
| 38 | + public function __construct(string $valueClassName) { |
|
| 41 | 39 | parent::__construct($valueClassName); |
| 42 | 40 | } |
| 43 | 41 | |
@@ -74,9 +74,9 @@ |
||
| 74 | 74 | * |
| 75 | 75 | * @return void |
| 76 | 76 | */ |
| 77 | - protected function addValidator(string $className, string $title, bool $breakOnError = true, array $configuration = null): void |
|
| 77 | + protected function addValidator(string $className, string $title, bool $breakOnError = TRUE, array $configuration = NULL): void |
|
| 78 | 78 | { |
| 79 | - if ($configuration === null) { |
|
| 79 | + if ($configuration === NULL) { |
|
| 80 | 80 | $validator = GeneralUtility::makeInstance($className); |
| 81 | 81 | } else { |
| 82 | 82 | $validator = GeneralUtility::makeInstance($className, $configuration); |
@@ -61,11 +61,11 @@ |
||
| 61 | 61 | protected function process(mixed $value): string |
| 62 | 62 | { |
| 63 | 63 | // using source from standard input |
| 64 | - $process = new Process(['java', '-jar', $this->jar, '-xsl:' . $this->xsl, '-s:-'], null, null, $value->saveXML()); |
|
| 64 | + $process = new Process(['java', '-jar', $this->jar, '-xsl:'.$this->xsl, '-s:-'], null, null, $value->saveXML()); |
|
| 65 | 65 | $process->run(); |
| 66 | 66 | // executes after the command finish |
| 67 | 67 | if (!$process->isSuccessful()) { |
| 68 | - $this->logger->error('Processing exits with code "' . $process->getExitCode() . '"'); |
|
| 68 | + $this->logger->error('Processing exits with code "'.$process->getExitCode().'"'); |
|
| 69 | 69 | throw new InvalidArgumentException('Processing was not successful.', 1724862680); |
| 70 | 70 | } |
| 71 | 71 | return $process->getOutput(); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | protected function process(mixed $value): string |
| 62 | 62 | { |
| 63 | 63 | // using source from standard input |
| 64 | - $process = new Process(['java', '-jar', $this->jar, '-xsl:' . $this->xsl, '-s:-'], null, null, $value->saveXML()); |
|
| 64 | + $process = new Process(['java', '-jar', $this->jar, '-xsl:' . $this->xsl, '-s:-'], NULL, NULL, $value->saveXML()); |
|
| 65 | 65 | $process->run(); |
| 66 | 66 | // executes after the command finish |
| 67 | 67 | if (!$process->isSuccessful()) { |
@@ -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"] ?? ''); |
@@ -78,19 +78,19 @@ |
||
| 78 | 78 | $validation = GeneralUtility::makeInstance(DOMDocumentValidationStack::class, $settings['domDocumentValidationValidators']); |
| 79 | 79 | |
| 80 | 80 | if (!GeneralUtility::isValidUrl($urlParam)) { |
| 81 | - $this->logger->debug('Parameter "' . $urlParam . '" is not a valid url.'); |
|
| 81 | + $this->logger->debug('Parameter "'.$urlParam.'" is not a valid url.'); |
|
| 82 | 82 | throw new InvalidArgumentException('Value of url parameter is not a valid url.', 1724852611); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $content = GeneralUtility::getUrl($urlParam); |
| 86 | 86 | if ($content === false) { |
| 87 | - $this->logger->debug('Error while loading content of "' . $urlParam . '"'); |
|
| 87 | + $this->logger->debug('Error while loading content of "'.$urlParam.'"'); |
|
| 88 | 88 | throw new InvalidArgumentException('Error while loading content of url.', 1724420640); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $document = new DOMDocument(); |
| 92 | 92 | if ($document->loadXML($content) === false) { |
| 93 | - $this->logger->debug('Error converting content of "' . $urlParam . '" to xml.'); |
|
| 93 | + $this->logger->debug('Error converting content of "'.$urlParam.'" to xml.'); |
|
| 94 | 94 | throw new InvalidArgumentException('Error converting content to xml.', 1724420648); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -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 | /** |
@@ -83,13 +83,13 @@ |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $content = GeneralUtility::getUrl($urlParam); |
| 86 | - if ($content === false) { |
|
| 86 | + if ($content === FALSE) { |
|
| 87 | 87 | $this->logger->debug('Error while loading content of "' . $urlParam . '"'); |
| 88 | 88 | throw new InvalidArgumentException('Error while loading content of url.', 1724420640); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $document = new DOMDocument(); |
| 92 | - if ($document->loadXML($content) === false) { |
|
| 92 | + if ($document->loadXML($content) === FALSE) { |
|
| 93 | 93 | $this->logger->debug('Error converting content of "' . $urlParam . '" to xml.'); |
| 94 | 94 | throw new InvalidArgumentException('Error converting content to xml.', 1724420648); |
| 95 | 95 | } |
@@ -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"> |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | parent::setUp(); |
| 50 | 50 | $this->resetSingletonInstances = true; |
| 51 | - $this->dlfExtensionPath = Environment::getExtensionsPath() . 'dlf'; |
|
| 51 | + $this->dlfExtensionPath = Environment::getExtensionsPath().'dlf'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function testJarFileNotFound(): void |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | $this->expectException(InvalidArgumentException::class); |
| 64 | 64 | $this->expectExceptionMessage("XSL Schematron file not found."); |
| 65 | 65 | // It only checks if a file exists at the specified path, so we can use one of the test files. |
| 66 | - new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath . '/Tests/Fixtures/Format/alto.xml']); |
|
| 66 | + new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath.'/Tests/Fixtures/Format/alto.xml']); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function testValidation(): void |
| 70 | 70 | { |
| 71 | - $saxonXslToSvrlValidator = new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath . '/Tests/Fixtures/Format/alto.xml', "xsl" => $this->dlfExtensionPath . '/Tests/Fixtures/Format/alto.xml']); |
|
| 71 | + $saxonXslToSvrlValidator = new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath.'/Tests/Fixtures/Format/alto.xml', "xsl" => $this->dlfExtensionPath.'/Tests/Fixtures/Format/alto.xml']); |
|
| 72 | 72 | $reflection = new ReflectionClass($saxonXslToSvrlValidator); |
| 73 | 73 | |
| 74 | 74 | $result = $reflection->getProperty("result"); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function setUp(): void |
| 48 | 48 | { |
| 49 | 49 | parent::setUp(); |
| 50 | - $this->resetSingletonInstances = true; |
|
| 50 | + $this->resetSingletonInstances = TRUE; |
|
| 51 | 51 | $this->dlfExtensionPath = Environment::getExtensionsPath() . 'dlf'; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | $reflection = new ReflectionClass($saxonXslToSvrlValidator); |
| 73 | 73 | |
| 74 | 74 | $result = $reflection->getProperty("result"); |
| 75 | - $result->setAccessible(true); |
|
| 75 | + $result->setAccessible(TRUE); |
|
| 76 | 76 | $result->setValue($saxonXslToSvrlValidator, new Result()); |
| 77 | 77 | |
| 78 | 78 | $method = $reflection->getMethod("addErrorsOfSvrl"); |
| 79 | - $method->setAccessible(true); |
|
| 79 | + $method->setAccessible(TRUE); |
|
| 80 | 80 | $method->invoke($saxonXslToSvrlValidator, self::SVRL); |
| 81 | 81 | |
| 82 | 82 | self::assertTrue($result->getValue($saxonXslToSvrlValidator)->hasErrors()); |
@@ -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(); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | public function setUp(): void |
| 35 | 35 | { |
| 36 | 36 | parent::setUp(); |
| 37 | - $this->resetSingletonInstances = true; |
|
| 37 | + $this->resetSingletonInstances = TRUE; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function testValueTypeException(): void |
@@ -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; |
@@ -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 | } |
@@ -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']) { |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | public function validate($value): Result |
| 48 | 48 | { |
| 49 | 49 | if (!$value instanceof $this->valueClassName) { |
| 50 | - $this->logger->debug('Value must be an instance of ' . $this->valueClassName . '.'); |
|
| 50 | + $this->logger->debug('Value must be an instance of '.$this->valueClassName.'.'); |
|
| 51 | 51 | throw new InvalidArgumentException('Type of value is not valid.', 1723126505626); |
| 52 | 52 | } |
| 53 | 53 | return parent::validate($value); |
@@ -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 | } |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * @subpackage dlf |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class AnnotationController extends AbstractController |
|
| 26 | -{ |
|
| 25 | +class AnnotationController extends AbstractController { |
|
| 27 | 26 | /** |
| 28 | 27 | * The main method of the plugin |
| 29 | 28 | * |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | $this->loadDocument(); |
| 35 | 35 | |
| 36 | 36 | if ( |
| 37 | - $this->document === null |
|
| 38 | - || $this->document->getCurrentDocument() === null |
|
| 37 | + $this->document === NULL |
|
| 38 | + || $this->document->getCurrentDocument() === NULL |
|
| 39 | 39 | ) { |
| 40 | 40 | // Quit without doing anything if required variables are not set. |
| 41 | 41 | } else { |