@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | $fulltext['mimetype'] = $file['mimeType']; |
120 | 120 | break; |
121 | 121 | } else { |
122 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
122 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | if (empty($fulltext)) { |
126 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->extConf['files']['fileGrpFulltext'] . '"'); |
|
126 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->extConf['files']['fileGrpFulltext'].'"'); |
|
127 | 127 | } |
128 | 128 | return $fulltext; |
129 | 129 | } |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | $viewerConfiguration = '$(document).ready(function() { |
142 | 142 | if (dlfUtils.exists(dlfViewer)) { |
143 | 143 | tx_dlf_viewer = new dlfViewer({ |
144 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
145 | - div: "' . $this->settings['elementId'] . '", |
|
146 | - progressElementId: "' . $this->settings['progressElementId'] . '", |
|
147 | - images: ' . json_encode($this->images) . ', |
|
148 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
149 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
150 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ' |
|
144 | + controls: ["' . implode('", "', $this->controls).'"], |
|
145 | + div: "' . $this->settings['elementId'].'", |
|
146 | + progressElementId: "' . $this->settings['progressElementId'].'", |
|
147 | + images: ' . json_encode($this->images).', |
|
148 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
149 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
150 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).' |
|
151 | 151 | }); |
152 | 152 | } |
153 | 153 | });'; |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | } |
241 | 241 | break; |
242 | 242 | } else { |
243 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
243 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | if (empty($image)) { |
247 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->extConf['files']['fileGrpImages'] . '"'); |
|
247 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->extConf['files']['fileGrpImages'].'"'); |
|
248 | 248 | } |
249 | 249 | return $image; |
250 | 250 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | $file = $this->getFileInfo($id); |
190 | 190 | if ($file['mimeType'] === 'application/vnd.kitodo.iiif') { |
191 | - $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'] . 'info.json' : $file['location'] . '/info.json'); |
|
191 | + $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'].'info.json' : $file['location'].'/info.json'); |
|
192 | 192 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif'); |
193 | 193 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
194 | 194 | IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']); |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | return $service->getImageUrl(); |
199 | 199 | } |
200 | 200 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
201 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
201 | + $baseURL = $file['location'].(strpos($file['location'], '?') === false ? '?' : ''); |
|
202 | 202 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
203 | - return $baseURL . '&CVT=jpeg'; |
|
203 | + return $baseURL.'&CVT=jpeg'; |
|
204 | 204 | } |
205 | 205 | return $file['location']; |
206 | 206 | } |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function getFileLocation(string $id): string |
231 | 231 | { |
232 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
232 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
233 | 233 | if ( |
234 | 234 | !empty($id) |
235 | 235 | && !empty($location) |
236 | 236 | ) { |
237 | 237 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
238 | 238 | } else { |
239 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
239 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
240 | 240 | return ''; |
241 | 241 | } |
242 | 242 | } |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function getFileMimeType(string $id): string |
248 | 248 | { |
249 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
249 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
250 | 250 | if ( |
251 | 251 | !empty($id) |
252 | 252 | && !empty($mimetype) |
253 | 253 | ) { |
254 | 254 | return (string) $mimetype[0]; |
255 | 255 | } else { |
256 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
256 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
257 | 257 | return ''; |
258 | 258 | } |
259 | 259 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | return $this->logicalUnits[$id]; |
274 | 274 | } elseif (!empty($id)) { |
275 | 275 | // Get specified logical unit. |
276 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
276 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
277 | 277 | } else { |
278 | 278 | // Get all logical units at top level. |
279 | 279 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $cPid = max($cPid, 0); |
462 | 462 | if ($cPid == 0 && ($this->cPid || $this->pid)) { |
463 | 463 | // Retain current PID. |
464 | - $cPid = $this->cPid ?: $this->pid; |
|
464 | + $cPid = $this->cPid ? : $this->pid; |
|
465 | 465 | } |
466 | 466 | return $cPid; |
467 | 467 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | if (isset($this->fileInfos[$id]) || isset($hasMetadataSection['dmdSec'])) { |
529 | 529 | return $metadata; |
530 | 530 | } else { |
531 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
531 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
532 | 532 | return []; |
533 | 533 | } |
534 | 534 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | if (!empty($this->logicalUnits[$id])) { |
548 | 548 | return [$this->logicalUnits[$id]['type']]; |
549 | 549 | } else { |
550 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
550 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
551 | 551 | if (!empty($struct)) { |
552 | 552 | return [(string) $struct[0]]; |
553 | 553 | } |
@@ -674,13 +674,13 @@ discard block |
||
674 | 674 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
675 | 675 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
676 | 676 | if ($values instanceof \DOMNodeList && $values->length > 0) { |
677 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
677 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
678 | 678 | } elseif (!($values instanceof \DOMNodeList)) { |
679 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
679 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
680 | 680 | } |
681 | 681 | } |
682 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
683 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
682 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
683 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
@@ -740,11 +740,11 @@ discard block |
||
740 | 740 | return true; |
741 | 741 | } |
742 | 742 | } else { |
743 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
743 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 | } else { |
747 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
747 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
748 | 748 | } |
749 | 749 | return false; |
750 | 750 | } |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
852 | 852 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
853 | 853 | } else { |
854 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
854 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
855 | 855 | if ($mdSec) { |
856 | 856 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
857 | 857 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | |
882 | 882 | return array_filter( |
883 | 883 | $allMdIds, |
884 | - function ($element) { |
|
884 | + function($element) { |
|
885 | 885 | return !empty($element); |
886 | 886 | } |
887 | 887 | ); |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | */ |
908 | 908 | public function getStructureDepth(string $logId) |
909 | 909 | { |
910 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
910 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
911 | 911 | if (!empty($ancestors)) { |
912 | 912 | return count($ancestors); |
913 | 913 | } else { |
@@ -931,9 +931,9 @@ discard block |
||
931 | 931 | $this->registerNamespaces($this->mets); |
932 | 932 | } else { |
933 | 933 | if (!empty($location)) { |
934 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
934 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
935 | 935 | } elseif (!empty($this->recordId)) { |
936 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
936 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
937 | 937 | } else { |
938 | 938 | $this->logger->error('No METS part found in current document.'); |
939 | 939 | } |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | return true; |
955 | 955 | } |
956 | 956 | } |
957 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
957 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
958 | 958 | return false; |
959 | 959 | } |
960 | 960 | |
@@ -1077,10 +1077,10 @@ discard block |
||
1077 | 1077 | |
1078 | 1078 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
1079 | 1079 | $type = (string) $mdType[0]; |
1080 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
1080 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
1081 | 1081 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
1082 | 1082 | $type = (string) $otherMdType[0]; |
1083 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
1083 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | if (empty($xml)) { |
@@ -1273,9 +1273,9 @@ discard block |
||
1273 | 1273 | || $forceReload |
1274 | 1274 | ) { |
1275 | 1275 | // Retain current PID. |
1276 | - $cPid = $this->cPid ?: $this->pid; |
|
1276 | + $cPid = $this->cPid ? : $this->pid; |
|
1277 | 1277 | if (!$cPid) { |
1278 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
1278 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
1279 | 1279 | $this->thumbnailLoaded = true; |
1280 | 1280 | return $this->thumbnail; |
1281 | 1281 | } |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | if (!empty($resArray['thumbnail'])) { |
1313 | 1313 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
1314 | 1314 | // Check if this document has a structure element of the desired type. |
1315 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
1315 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
1316 | 1316 | if (!empty($strctIds)) { |
1317 | 1317 | $strctId = (string) $strctIds[0]; |
1318 | 1318 | } |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | } |
1336 | 1336 | } |
1337 | 1337 | } else { |
1338 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
1338 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
1339 | 1339 | } |
1340 | 1340 | $this->thumbnailLoaded = true; |
1341 | 1341 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | { |
1382 | 1382 | if (empty($this->parentHref)) { |
1383 | 1383 | // Get the closest ancestor of the current document which has a MPTR child. |
1384 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
1384 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
1385 | 1385 | if (!empty($parentMptr)) { |
1386 | 1386 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
1387 | 1387 | } |
@@ -21,14 +21,14 @@ |
||
21 | 21 | { |
22 | 22 | parent::setUp(); |
23 | 23 | |
24 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.csv'); |
|
25 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/metadata.csv'); |
|
26 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv'); |
|
24 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/documents_1.csv'); |
|
25 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/metadata.csv'); |
|
26 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/MetsDocument/metadata_mets.csv'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function doc(string $file) |
30 | 30 | { |
31 | - $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file; |
|
31 | + $url = 'http://web:8001/Tests/Fixtures/MetsDocument/'.$file; |
|
32 | 32 | $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]); |
33 | 33 | self::assertNotNull($doc); |
34 | 34 | return $doc; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (!empty($name)) { |
125 | 125 | $this->metadata['author'][$i] = [ |
126 | 126 | 'name' => $name, |
127 | - 'url' => 'https://orcid.org/' . $orcidId |
|
127 | + 'url' => 'https://orcid.org/'.$orcidId |
|
128 | 128 | ]; |
129 | 129 | } else { |
130 | 130 | //fallback into display form |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | // Append "valueURI" to name using Unicode unit separator. |
183 | 183 | if (!empty($authors[$i]->getValueURI())) { |
184 | - $this->metadata['author'][$i] .= pack('C', 31) . $authors[$i]->getValueURI(); |
|
184 | + $this->metadata['author'][$i] .= pack('C', 31).$authors[$i]->getValueURI(); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (!empty($name)) { |
245 | 245 | $this->metadata['holder'][$i] = [ |
246 | 246 | 'name' => $name, |
247 | - 'url' => 'http://viaf.org/viaf/' . $viafId |
|
247 | + 'url' => 'http://viaf.org/viaf/'.$viafId |
|
248 | 248 | ]; |
249 | 249 | } else { |
250 | 250 | //fallback into display form |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $this->getHolderFromXmlDisplayForm($holders, $i); |
268 | 268 | // Append "valueURI" to name using Unicode unit separator. |
269 | 269 | if (!empty($holders[$i]->getValueURI())) { |
270 | - $this->metadata['holder'][$i] .= pack('C', 31) . $holders[$i]->getValueURI(); |
|
270 | + $this->metadata['holder'][$i] .= pack('C', 31).$holders[$i]->getValueURI(); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | foreach ($this->requiredMetadataFields as $requiredMetadataField) { |
84 | 84 | if (empty($this->metadata[$requiredMetadataField][0])) { |
85 | - $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".'); |
|
85 | + $this->logger->error('Missing required metadata field "'.$requiredMetadataField.'".'); |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | } |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function hasCorrectLogicalStructure(string $type): bool |
102 | 102 | { |
103 | - $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]'); |
|
103 | + $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="'.$type.'"]'); |
|
104 | 104 | if ($expectedNodes) { |
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
109 | 109 | if ($existingNodes) { |
110 | - $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.'); |
|
110 | + $this->logger->error('Document contains logical structure but @TYPE="'.$type.'" is missing.'); |
|
111 | 111 | return false; |
112 | 112 | } |
113 | 113 |
@@ -105,7 +105,7 @@ |
||
105 | 105 | |
106 | 106 | private function getXml(string $file): SimpleXMLElement |
107 | 107 | { |
108 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/MetsDocument/' . $file); |
|
108 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/MetsDocument/'.$file); |
|
109 | 109 | self::assertNotFalse($xml); |
110 | 110 | return $xml; |
111 | 111 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $parent->setCurrentDocument($doc); |
115 | 115 | $success = self::add($parent, $documentRepository); |
116 | 116 | } else { |
117 | - Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR); |
|
117 | + Helper::log('Could not load parent document with UID '.$document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR); |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | } |
@@ -197,19 +197,19 @@ discard block |
||
197 | 197 | } catch (\Exception $e) { |
198 | 198 | if (!(Environment::isCli())) { |
199 | 199 | Helper::addMessage( |
200 | - Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
|
200 | + Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()), |
|
201 | 201 | Helper::getLanguageService()->getLL('flash.error'), |
202 | 202 | FlashMessage::ERROR, |
203 | 203 | true, |
204 | 204 | 'core.template.flashMessages' |
205 | 205 | ); |
206 | 206 | } |
207 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
207 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | - Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core ' . $solrCoreUid, LOG_SEVERITY_ERROR); |
|
212 | + Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core '.$solrCoreUid, LOG_SEVERITY_ERROR); |
|
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | // Sanitize input. |
231 | 231 | $pid = max((int) $pid, 0); |
232 | 232 | if (!$pid) { |
233 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
233 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
234 | 234 | return ''; |
235 | 235 | } |
236 | 236 | // Load metadata configuration. |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $suffix = (in_array($indexName, self::$fields['tokenized']) ? 't' : 'u'); |
240 | 240 | $suffix .= (in_array($indexName, self::$fields['stored']) ? 's' : 'u'); |
241 | 241 | $suffix .= (in_array($indexName, self::$fields['indexed']) ? 'i' : 'u'); |
242 | - $indexName .= '_' . $suffix; |
|
242 | + $indexName .= '_'.$suffix; |
|
243 | 243 | return $indexName; |
244 | 244 | } |
245 | 245 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
361 | 361 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
362 | 362 | // verify date formatting |
363 | - if(strtotime($metadata['date'][0])) { |
|
363 | + if (strtotime($metadata['date'][0])) { |
|
364 | 364 | $solrDoc->setField('date', self::getFormattedDate($metadata['date'][0])); |
365 | 365 | } |
366 | 366 | $solrDoc->setField('record_id', $metadata['record_id'][0]); |
@@ -523,11 +523,11 @@ discard block |
||
523 | 523 | $solrDoc->setField(self::getIndexFieldName($indexName, $document->getPid()), $data, self::$fields['fieldboost'][$indexName]); |
524 | 524 | if (in_array($indexName, self::$fields['sortables'])) { |
525 | 525 | // Add sortable fields to index. |
526 | - $solrDoc->setField($indexName . '_sorting', $metadata[$indexName . '_sorting'][0]); |
|
526 | + $solrDoc->setField($indexName.'_sorting', $metadata[$indexName.'_sorting'][0]); |
|
527 | 527 | } |
528 | 528 | if (in_array($indexName, self::$fields['facets'])) { |
529 | 529 | // Add facets to index. |
530 | - $solrDoc->setField($indexName . '_faceting', $data); |
|
530 | + $solrDoc->setField($indexName.'_faceting', $data); |
|
531 | 531 | } |
532 | 532 | if (in_array($indexName, self::$fields['autocomplete'])) { |
533 | 533 | $autocomplete = array_merge($autocomplete, $data); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $data = self::removeAppendsFromAuthor($data); |
564 | 564 | } |
565 | 565 | // Add facets to index. |
566 | - $solrDoc->setField($indexName . '_faceting', $data); |
|
566 | + $solrDoc->setField($indexName.'_faceting', $data); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | // Add sorting information to physical sub-elements if applicable. |
@@ -593,9 +593,9 @@ discard block |
||
593 | 593 | $update = self::$solr->service->createUpdate(); |
594 | 594 | $query = ""; |
595 | 595 | if ($field == 'uid' || $field == 'partof') { |
596 | - $query = $field . ':' . $value; |
|
596 | + $query = $field.':'.$value; |
|
597 | 597 | } else { |
598 | - $query = $field . ':"' . $value . '"'; |
|
598 | + $query = $field.':"'.$value.'"'; |
|
599 | 599 | } |
600 | 600 | $update->addDeleteQuery($query); |
601 | 601 | $update->addCommit(); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | { |
621 | 621 | $solrDoc = $updateQuery->createDocument(); |
622 | 622 | // Create unique identifier from document's UID and unit's XML ID. |
623 | - $solrDoc->setField('id', $document->getUid() . $unit['id']); |
|
623 | + $solrDoc->setField('id', $document->getUid().$unit['id']); |
|
624 | 624 | $solrDoc->setField('uid', $document->getUid()); |
625 | 625 | $solrDoc->setField('pid', $document->getPid()); |
626 | 626 | $solrDoc->setField('partof', $document->getPartof()); |
@@ -699,9 +699,9 @@ discard block |
||
699 | 699 | private static function handleException(string $errorMessage): void |
700 | 700 | { |
701 | 701 | if (!(Environment::isCli())) { |
702 | - self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($errorMessage)); |
|
702 | + self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($errorMessage)); |
|
703 | 703 | } |
704 | - Helper::log('Apache Solr threw exception: "' . $errorMessage . '"', LOG_SEVERITY_ERROR); |
|
704 | + Helper::log('Apache Solr threw exception: "'.$errorMessage.'"', LOG_SEVERITY_ERROR); |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->initializeRepositories((int) $input->getOption('pid')); |
112 | 112 | |
113 | 113 | if ($this->storagePid == 0) { |
114 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
114 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
115 | 115 | return BaseCommand::FAILURE; |
116 | 116 | } |
117 | 117 | |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
130 | 130 | $output_solrCores = []; |
131 | 131 | foreach ($allSolrCores as $index_name => $uid) { |
132 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
132 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
133 | 133 | } |
134 | 134 | if (empty($output_solrCores)) { |
135 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
135 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
136 | 136 | return BaseCommand::FAILURE; |
137 | 137 | } else { |
138 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
139 | 139 | return BaseCommand::FAILURE; |
140 | 140 | } |
141 | 141 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return BaseCommand::FAILURE; |
156 | 156 | } |
157 | 157 | if (!GeneralUtility::isValidUrl($baseUrl)) { |
158 | - $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").'); |
|
158 | + $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").'); |
|
159 | 159 | return BaseCommand::FAILURE; |
160 | 160 | } else { |
161 | 161 | try { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | if (empty($set)) { |
200 | - $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").'); |
|
200 | + $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").'); |
|
201 | 201 | return BaseCommand::FAILURE; |
202 | 202 | } |
203 | 203 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | // Process all identifiers. |
218 | - $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
218 | + $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
219 | 219 | foreach ($identifiers as $identifier) { |
220 | 220 | // Build OAI GetRecord URL... |
221 | 221 | $params = [ |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | 'metadataPrefix' => 'mets', |
224 | 224 | 'identifier' => (string) $identifier->identifier |
225 | 225 | ]; |
226 | - $docLocation = $baseLocation . http_build_query($params); |
|
226 | + $docLocation = $baseLocation.http_build_query($params); |
|
227 | 227 | // ...index the document... |
228 | 228 | $document = null; |
229 | 229 | $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
230 | 230 | |
231 | 231 | if ($doc === null) { |
232 | - $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
|
232 | + $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.'); |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | $document->setSolrcore($solrCoreUid); |
247 | 247 | |
248 | 248 | if ($dryRun) { |
249 | - $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
249 | + $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
250 | 250 | } else { |
251 | 251 | if ($io->isVerbose()) { |
252 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
252 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
253 | 253 | } |
254 | 254 | $document->setCurrentDocument($doc); |
255 | 255 | // save to database |
@@ -276,6 +276,6 @@ discard block |
||
276 | 276 | */ |
277 | 277 | protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io): void |
278 | 278 | { |
279 | - $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
|
279 | + $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n ".$exception->getMessage()); |
|
280 | 280 | } |
281 | 281 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->initializeRepositories((int) $input->getOption('pid')); |
99 | 99 | |
100 | 100 | if ($this->storagePid == 0) { |
101 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
101 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
102 | 102 | return BaseCommand::FAILURE; |
103 | 103 | } |
104 | 104 | |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
114 | 114 | $output_solrCores = []; |
115 | 115 | foreach ($allSolrCores as $index_name => $uid) { |
116 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
116 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
117 | 117 | } |
118 | 118 | if (empty($output_solrCores)) { |
119 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
119 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
120 | 120 | return BaseCommand::FAILURE; |
121 | 121 | } else { |
122 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
122 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
123 | 123 | return BaseCommand::FAILURE; |
124 | 124 | } |
125 | 125 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
160 | 160 | |
161 | 161 | if ($document === null) { |
162 | - $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .'); |
|
162 | + $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .'); |
|
163 | 163 | exit(1); |
164 | 164 | } else { |
165 | 165 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
@@ -172,31 +172,31 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | if ($doc === null) { |
175 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
175 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
176 | 176 | return BaseCommand::FAILURE; |
177 | 177 | } |
178 | 178 | |
179 | 179 | $document->setSolrcore($solrCoreUid); |
180 | 180 | |
181 | 181 | if ($dryRun) { |
182 | - $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
182 | + $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
183 | 183 | $io->success('All done!'); |
184 | 184 | return BaseCommand::SUCCESS; |
185 | 185 | } else { |
186 | 186 | $document->setCurrentDocument($doc); |
187 | 187 | |
188 | 188 | if ($io->isVerbose()) { |
189 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
189 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
190 | 190 | } |
191 | 191 | $isSaved = $this->saveToDatabase($document); |
192 | 192 | |
193 | 193 | if ($isSaved) { |
194 | 194 | if ($io->isVerbose()) { |
195 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on Solr core ' . $solrCoreUid . '.'); |
|
195 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on Solr core '.$solrCoreUid.'.'); |
|
196 | 196 | } |
197 | 197 | $isSaved = Indexer::add($document, $this->documentRepository); |
198 | 198 | } else { |
199 | - $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on PID ' . $this->storagePid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.'); |
|
199 | + $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on PID '.$this->storagePid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.'); |
|
200 | 200 | return BaseCommand::FAILURE; |
201 | 201 | } |
202 | 202 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | return BaseCommand::SUCCESS; |
206 | 206 | } |
207 | 207 | |
208 | - $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on Solr core ' . $solrCoreUid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.'); |
|
209 | - $io->info('INFO: Document with UID "' . $document->getUid() . '" is already in database. If you want to keep the database and index consistent you need to remove it.'); |
|
208 | + $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on Solr core '.$solrCoreUid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.'); |
|
209 | + $io->info('INFO: Document with UID "'.$document->getUid().'" is already in database. If you want to keep the database and index consistent you need to remove it.'); |
|
210 | 210 | return BaseCommand::FAILURE; |
211 | 211 | } |
212 | 212 | } |