We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -90,8 +90,7 @@ |
||
| 90 | 90 | * |
| 91 | 91 | * @return boolean TRUE if document type matches, FALSE if not |
| 92 | 92 | */ |
| 93 | - function user_dlf_docTypeCheck($type) |
|
| 94 | - { |
|
| 93 | + function user_dlf_docTypeCheck($type) { |
|
| 95 | 94 | $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Kitodo\Dlf\Common\DocumentTypeCheck::class); |
| 96 | 95 | return ($hook->getDocType() === $type); |
| 97 | 96 | } |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * @subpackage dlf |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class Indexer |
|
| 30 | -{ |
|
| 29 | +class Indexer { |
|
| 31 | 30 | /** |
| 32 | 31 | * The extension key |
| 33 | 32 | * |
@@ -88,8 +87,7 @@ discard block |
||
| 88 | 87 | * |
| 89 | 88 | * @return integer 0 on success or 1 on failure |
| 90 | 89 | */ |
| 91 | - public static function add(Document &$doc, $core = 0) |
|
| 92 | - { |
|
| 90 | + public static function add(Document &$doc, $core = 0) { |
|
| 93 | 91 | if (in_array($doc->uid, self::$processedDocs)) { |
| 94 | 92 | return 0; |
| 95 | 93 | } elseif (self::solrConnect($core, $doc->pid)) { |
@@ -204,8 +202,7 @@ discard block |
||
| 204 | 202 | * |
| 205 | 203 | * @return integer 0 on success or 1 on failure |
| 206 | 204 | */ |
| 207 | - public static function delete($uid) |
|
| 208 | - { |
|
| 205 | + public static function delete($uid) { |
|
| 209 | 206 | // Sanitize input. |
| 210 | 207 | $uid = max(intval($uid), 0); |
| 211 | 208 | // Get Solr core for document. |
@@ -278,8 +275,7 @@ discard block |
||
| 278 | 275 | * |
| 279 | 276 | * @return string The field's dynamic index name |
| 280 | 277 | */ |
| 281 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
| 282 | - { |
|
| 278 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
| 283 | 279 | // Sanitize input. |
| 284 | 280 | $pid = max(intval($pid), 0); |
| 285 | 281 | if (!$pid) { |
@@ -305,8 +301,7 @@ discard block |
||
| 305 | 301 | * |
| 306 | 302 | * @return void |
| 307 | 303 | */ |
| 308 | - protected static function loadIndexConf($pid) |
|
| 309 | - { |
|
| 304 | + protected static function loadIndexConf($pid) { |
|
| 310 | 305 | if (!self::$fieldsLoaded) { |
| 311 | 306 | /** @var QueryBuilder $queryBuilder */ |
| 312 | 307 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -377,8 +372,7 @@ discard block |
||
| 377 | 372 | * |
| 378 | 373 | * @return integer 0 on success or 1 on failure |
| 379 | 374 | */ |
| 380 | - protected static function processLogical(Document &$doc, array $logicalUnit) |
|
| 381 | - { |
|
| 375 | + protected static function processLogical(Document &$doc, array $logicalUnit) { |
|
| 382 | 376 | $errors = 0; |
| 383 | 377 | // Get metadata for logical unit. |
| 384 | 378 | $metadata = $doc->metadataArray[$logicalUnit['id']]; |
@@ -495,8 +489,7 @@ discard block |
||
| 495 | 489 | * |
| 496 | 490 | * @return integer 0 on success or 1 on failure |
| 497 | 491 | */ |
| 498 | - protected static function processPhysical(Document &$doc, $page, array $physicalUnit) |
|
| 499 | - { |
|
| 492 | + protected static function processPhysical(Document &$doc, $page, array $physicalUnit) { |
|
| 500 | 493 | $errors = 0; |
| 501 | 494 | // Read extension configuration. |
| 502 | 495 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -606,8 +599,7 @@ discard block |
||
| 606 | 599 | * |
| 607 | 600 | * @return boolean TRUE on success or FALSE on failure |
| 608 | 601 | */ |
| 609 | - protected static function solrConnect($core, $pid = 0) |
|
| 610 | - { |
|
| 602 | + protected static function solrConnect($core, $pid = 0) { |
|
| 611 | 603 | // Get Solr instance. |
| 612 | 604 | if (!self::$solr) { |
| 613 | 605 | // Connect to Solr server. |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class Solr |
|
| 29 | -{ |
|
| 28 | +class Solr { |
|
| 30 | 29 | /** |
| 31 | 30 | * This holds the core name |
| 32 | 31 | * |
@@ -108,8 +107,7 @@ discard block |
||
| 108 | 107 | * |
| 109 | 108 | * @return string The escaped query string |
| 110 | 109 | */ |
| 111 | - public static function escapeQuery($query) |
|
| 112 | - { |
|
| 110 | + public static function escapeQuery($query) { |
|
| 113 | 111 | $helper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
| 114 | 112 | // Escape query phrase or term. |
| 115 | 113 | if (preg_match('/^".*"$/', $query)) { |
@@ -129,8 +127,7 @@ discard block |
||
| 129 | 127 | * |
| 130 | 128 | * @return string The escaped query string |
| 131 | 129 | */ |
| 132 | - public static function escapeQueryKeepField($query, $pid) |
|
| 133 | - { |
|
| 130 | + public static function escapeQueryKeepField($query, $pid) { |
|
| 134 | 131 | // Is there a field query? |
| 135 | 132 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
| 136 | 133 | /** @var QueryBuilder $queryBuilder */ |
@@ -187,8 +184,7 @@ discard block |
||
| 187 | 184 | * |
| 188 | 185 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 189 | 186 | */ |
| 190 | - public static function getInstance($core) |
|
| 191 | - { |
|
| 187 | + public static function getInstance($core) { |
|
| 192 | 188 | // Get core name if UID is given. |
| 193 | 189 | if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($core)) { |
| 194 | 190 | $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores'); |
@@ -226,8 +222,7 @@ discard block |
||
| 226 | 222 | * |
| 227 | 223 | * @return string The connection parameters for a specific Solr core |
| 228 | 224 | */ |
| 229 | - public static function getSolrConnectionInfo() |
|
| 230 | - { |
|
| 225 | + public static function getSolrConnectionInfo() { |
|
| 231 | 226 | $solrInfo = []; |
| 232 | 227 | // Extract extension configuration. |
| 233 | 228 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -256,8 +251,7 @@ discard block |
||
| 256 | 251 | * |
| 257 | 252 | * @return string The request URL for a specific Solr core |
| 258 | 253 | */ |
| 259 | - public static function getSolrUrl($core = '') |
|
| 260 | - { |
|
| 254 | + public static function getSolrUrl($core = '') { |
|
| 261 | 255 | // Get Solr connection information. |
| 262 | 256 | $solrInfo = self::getSolrConnectionInfo(); |
| 263 | 257 | if ( |
@@ -281,8 +275,7 @@ discard block |
||
| 281 | 275 | * |
| 282 | 276 | * @return integer First unused core number found |
| 283 | 277 | */ |
| 284 | - public static function solrGetCoreNumber($start = 0) |
|
| 285 | - { |
|
| 278 | + public static function solrGetCoreNumber($start = 0) { |
|
| 286 | 279 | $start = max(intval($start), 0); |
| 287 | 280 | // Check if core already exists. |
| 288 | 281 | if (self::getInstance('dlfCore' . $start) === NULL) { |
@@ -299,8 +292,7 @@ discard block |
||
| 299 | 292 | * |
| 300 | 293 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
| 301 | 294 | */ |
| 302 | - public function search() |
|
| 303 | - { |
|
| 295 | + public function search() { |
|
| 304 | 296 | $toplevel = []; |
| 305 | 297 | // Take over query parameters. |
| 306 | 298 | $params = $this->params; |
@@ -375,8 +367,7 @@ discard block |
||
| 375 | 367 | * |
| 376 | 368 | * @return array The Apache Solr Documents that were fetched |
| 377 | 369 | */ |
| 378 | - public function search_raw($query = '', $parameters = []) |
|
| 379 | - { |
|
| 370 | + public function search_raw($query = '', $parameters = []) { |
|
| 380 | 371 | // Set additional query parameters. |
| 381 | 372 | $parameters['start'] = 0; |
| 382 | 373 | $parameters['rows'] = $this->limit; |
@@ -410,8 +401,7 @@ discard block |
||
| 410 | 401 | * |
| 411 | 402 | * @return integer The max number of results |
| 412 | 403 | */ |
| 413 | - protected function _getLimit() |
|
| 414 | - { |
|
| 404 | + protected function _getLimit() { |
|
| 415 | 405 | return $this->limit; |
| 416 | 406 | } |
| 417 | 407 | |
@@ -422,8 +412,7 @@ discard block |
||
| 422 | 412 | * |
| 423 | 413 | * @return integer Total number of hits for last search |
| 424 | 414 | */ |
| 425 | - protected function _getNumberOfHits() |
|
| 426 | - { |
|
| 415 | + protected function _getNumberOfHits() { |
|
| 427 | 416 | return $this->numberOfHits; |
| 428 | 417 | } |
| 429 | 418 | |
@@ -434,8 +423,7 @@ discard block |
||
| 434 | 423 | * |
| 435 | 424 | * @return boolean Is the search instantiated successfully? |
| 436 | 425 | */ |
| 437 | - protected function _getReady() |
|
| 438 | - { |
|
| 426 | + protected function _getReady() { |
|
| 439 | 427 | return $this->ready; |
| 440 | 428 | } |
| 441 | 429 | |
@@ -446,8 +434,7 @@ discard block |
||
| 446 | 434 | * |
| 447 | 435 | * @return \Solarium\Client Apache Solr service object |
| 448 | 436 | */ |
| 449 | - protected function _getService() |
|
| 450 | - { |
|
| 437 | + protected function _getService() { |
|
| 451 | 438 | return $this->service; |
| 452 | 439 | } |
| 453 | 440 | |
@@ -460,8 +447,7 @@ discard block |
||
| 460 | 447 | * |
| 461 | 448 | * @return void |
| 462 | 449 | */ |
| 463 | - protected function _setCPid($value) |
|
| 464 | - { |
|
| 450 | + protected function _setCPid($value) { |
|
| 465 | 451 | $this->cPid = max(intval($value), 0); |
| 466 | 452 | } |
| 467 | 453 | |
@@ -474,8 +460,7 @@ discard block |
||
| 474 | 460 | * |
| 475 | 461 | * @return void |
| 476 | 462 | */ |
| 477 | - protected function _setLimit($value) |
|
| 478 | - { |
|
| 463 | + protected function _setLimit($value) { |
|
| 479 | 464 | $this->limit = max(intval($value), 0); |
| 480 | 465 | } |
| 481 | 466 | |
@@ -488,8 +473,7 @@ discard block |
||
| 488 | 473 | * |
| 489 | 474 | * @return void |
| 490 | 475 | */ |
| 491 | - protected function _setParams(array $value) |
|
| 492 | - { |
|
| 476 | + protected function _setParams(array $value) { |
|
| 493 | 477 | $this->params = $value; |
| 494 | 478 | } |
| 495 | 479 | |
@@ -502,8 +486,7 @@ discard block |
||
| 502 | 486 | * |
| 503 | 487 | * @return mixed Value of $this->$var |
| 504 | 488 | */ |
| 505 | - public function __get($var) |
|
| 506 | - { |
|
| 489 | + public function __get($var) { |
|
| 507 | 490 | $method = '_get' . ucfirst($var); |
| 508 | 491 | if ( |
| 509 | 492 | !property_exists($this, $var) |
@@ -526,8 +509,7 @@ discard block |
||
| 526 | 509 | * |
| 527 | 510 | * @return void |
| 528 | 511 | */ |
| 529 | - public function __set($var, $value) |
|
| 530 | - { |
|
| 512 | + public function __set($var, $value) { |
|
| 531 | 513 | $method = '_set' . ucfirst($var); |
| 532 | 514 | if ( |
| 533 | 515 | !property_exists($this, $var) |
@@ -548,8 +530,7 @@ discard block |
||
| 548 | 530 | * |
| 549 | 531 | * @return void |
| 550 | 532 | */ |
| 551 | - protected function __construct($core) |
|
| 552 | - { |
|
| 533 | + protected function __construct($core) { |
|
| 553 | 534 | $solrInfo = self::getSolrConnectionInfo(); |
| 554 | 535 | $config = [ |
| 555 | 536 | 'endpoint' => [ |
@@ -23,8 +23,7 @@ discard block |
||
| 23 | 23 | * @author Lutz Helm <[email protected]> |
| 24 | 24 | * |
| 25 | 25 | */ |
| 26 | -class IiifUrlReader implements UrlReaderInterface |
|
| 27 | -{ |
|
| 26 | +class IiifUrlReader implements UrlReaderInterface { |
|
| 28 | 27 | /** |
| 29 | 28 | * Singleton instance of the class |
| 30 | 29 | * |
@@ -38,8 +37,7 @@ discard block |
||
| 38 | 37 | * {@inheritDoc} |
| 39 | 38 | * @see \Ubl\Iiif\Tools\UrlReaderInterface::getContent() |
| 40 | 39 | */ |
| 41 | - public function getContent($url) |
|
| 42 | - { |
|
| 40 | + public function getContent($url) { |
|
| 43 | 41 | return GeneralUtility::getUrl($url); |
| 44 | 42 | } |
| 45 | 43 | |
@@ -50,8 +48,7 @@ discard block |
||
| 50 | 48 | * |
| 51 | 49 | * @return IiifUrlReader |
| 52 | 50 | */ |
| 53 | - public static function getInstance() |
|
| 54 | - { |
|
| 51 | + public static function getInstance() { |
|
| 55 | 52 | if (!isset(self::$instance)) { |
| 56 | 53 | self::$instance = new IiifUrlReader(); |
| 57 | 54 | } |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * @subpackage tx_dlf |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -final class MetsDocument extends Document |
|
| 31 | -{ |
|
| 30 | +final class MetsDocument extends Document { |
|
| 32 | 31 | /** |
| 33 | 32 | * This holds the whole XML file as string for serialization purposes |
| 34 | 33 | * @see __sleep() / __wakeup() |
@@ -129,8 +128,7 @@ discard block |
||
| 129 | 128 | * {@inheritDoc} |
| 130 | 129 | * @see \Kitodo\Dlf\Common\Document::establishRecordId() |
| 131 | 130 | */ |
| 132 | - protected function establishRecordId($pid) |
|
| 133 | - { |
|
| 131 | + protected function establishRecordId($pid) { |
|
| 134 | 132 | // Check for METS object @ID. |
| 135 | 133 | if (!empty($this->mets['OBJID'])) { |
| 136 | 134 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -150,8 +148,7 @@ discard block |
||
| 150 | 148 | * {@inheritDoc} |
| 151 | 149 | * @see \Kitodo\Dlf\Common\Document::getDownloadLocation() |
| 152 | 150 | */ |
| 153 | - public function getDownloadLocation($id) |
|
| 154 | - { |
|
| 151 | + public function getDownloadLocation($id) { |
|
| 155 | 152 | $fileMimeType = $this->getFileMimeType($id); |
| 156 | 153 | $fileLocation = $this->getFileLocation($id); |
| 157 | 154 | if ($fileMimeType == "application/vnd.kitodo.iiif") { |
@@ -176,8 +173,7 @@ discard block |
||
| 176 | 173 | * {@inheritDoc} |
| 177 | 174 | * @see \Kitodo\Dlf\Common\Document::getFileLocation() |
| 178 | 175 | */ |
| 179 | - public function getFileLocation($id) |
|
| 180 | - { |
|
| 176 | + public function getFileLocation($id) { |
|
| 181 | 177 | if ( |
| 182 | 178 | !empty($id) |
| 183 | 179 | && ($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]')) |
@@ -193,8 +189,7 @@ discard block |
||
| 193 | 189 | * {@inheritDoc} |
| 194 | 190 | * @see \Kitodo\Dlf\Common\Document::getFileMimeType() |
| 195 | 191 | */ |
| 196 | - public function getFileMimeType($id) |
|
| 197 | - { |
|
| 192 | + public function getFileMimeType($id) { |
|
| 198 | 193 | if ( |
| 199 | 194 | !empty($id) |
| 200 | 195 | && ($mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE')) |
@@ -210,8 +205,7 @@ discard block |
||
| 210 | 205 | * {@inheritDoc} |
| 211 | 206 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
| 212 | 207 | */ |
| 213 | - public function getLogicalStructure($id, $recursive = FALSE) |
|
| 214 | - { |
|
| 208 | + public function getLogicalStructure($id, $recursive = FALSE) { |
|
| 215 | 209 | $details = []; |
| 216 | 210 | // Is the requested logical unit already loaded? |
| 217 | 211 | if ( |
@@ -251,8 +245,7 @@ discard block |
||
| 251 | 245 | * |
| 252 | 246 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 253 | 247 | */ |
| 254 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE) |
|
| 255 | - { |
|
| 248 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE) { |
|
| 256 | 249 | // Get attributes. |
| 257 | 250 | foreach ($structure->attributes() as $attribute => $value) { |
| 258 | 251 | $attributes[$attribute] = (string) $value; |
@@ -294,14 +287,16 @@ discard block |
||
| 294 | 287 | } elseif ( |
| 295 | 288 | !empty($this->physicalStructure) |
| 296 | 289 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
| 297 | - ) { // Are there any physical elements and is this logical unit linked to at least one of them? |
|
| 290 | + ) { |
|
| 291 | +// Are there any physical elements and is this logical unit linked to at least one of them? |
|
| 298 | 292 | $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
| 299 | 293 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']])) { |
| 300 | 294 | $details['thumbnailId'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']]; |
| 301 | 295 | } |
| 302 | 296 | // Get page/track number of the first page/track related to this structure element. |
| 303 | 297 | $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel']; |
| 304 | - } elseif ($details['id'] == $this->_getToplevelId()) { // Is this the toplevel structure element? |
|
| 298 | + } elseif ($details['id'] == $this->_getToplevelId()) { |
|
| 299 | +// Is this the toplevel structure element? |
|
| 305 | 300 | // Yes. Point to itself. |
| 306 | 301 | $details['points'] = 1; |
| 307 | 302 | if ( |
@@ -341,8 +336,7 @@ discard block |
||
| 341 | 336 | * {@inheritDoc} |
| 342 | 337 | * @see \Kitodo\Dlf\Common\Document::getMetadata() |
| 343 | 338 | */ |
| 344 | - public function getMetadata($id, $cPid = 0) |
|
| 345 | - { |
|
| 339 | + public function getMetadata($id, $cPid = 0) { |
|
| 346 | 340 | // Make sure $cPid is a non-negative integer. |
| 347 | 341 | $cPid = max(intval($cPid), 0); |
| 348 | 342 | // If $cPid is not given, try to get it elsewhere. |
@@ -533,8 +527,7 @@ discard block |
||
| 533 | 527 | * {@inheritDoc} |
| 534 | 528 | * @see \Kitodo\Dlf\Common\Document::getRawText() |
| 535 | 529 | */ |
| 536 | - public function getRawText($id) |
|
| 537 | - { |
|
| 530 | + public function getRawText($id) { |
|
| 538 | 531 | $rawText = ''; |
| 539 | 532 | // Get text from raw text array if available. |
| 540 | 533 | if (!empty($this->rawTextArray[$id])) { |
@@ -552,8 +545,7 @@ discard block |
||
| 552 | 545 | * {@inheritDoc} |
| 553 | 546 | * @see Document::getStructureDepth() |
| 554 | 547 | */ |
| 555 | - public function getStructureDepth($logId) |
|
| 556 | - { |
|
| 548 | + public function getStructureDepth($logId) { |
|
| 557 | 549 | return count($this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*')); |
| 558 | 550 | } |
| 559 | 551 | |
@@ -561,8 +553,7 @@ discard block |
||
| 561 | 553 | * {@inheritDoc} |
| 562 | 554 | * @see \Kitodo\Dlf\Common\Document::init() |
| 563 | 555 | */ |
| 564 | - protected function init() |
|
| 565 | - { |
|
| 556 | + protected function init() { |
|
| 566 | 557 | // Get METS node from XML file. |
| 567 | 558 | $this->registerNamespaces($this->xml); |
| 568 | 559 | $mets = $this->xml->xpath('//mets:mets'); |
@@ -579,8 +570,7 @@ discard block |
||
| 579 | 570 | * {@inheritDoc} |
| 580 | 571 | * @see \Kitodo\Dlf\Common\Document::loadLocation() |
| 581 | 572 | */ |
| 582 | - protected function loadLocation($location) |
|
| 583 | - { |
|
| 573 | + protected function loadLocation($location) { |
|
| 584 | 574 | // Turn off libxml's error logging. |
| 585 | 575 | $libxmlErrors = libxml_use_internal_errors(TRUE); |
| 586 | 576 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
@@ -604,8 +594,7 @@ discard block |
||
| 604 | 594 | * {@inheritDoc} |
| 605 | 595 | * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet() |
| 606 | 596 | */ |
| 607 | - protected function ensureHasFulltextIsSet() |
|
| 608 | - { |
|
| 597 | + protected function ensureHasFulltextIsSet() { |
|
| 609 | 598 | // Are the fileGrps already loaded? |
| 610 | 599 | if (!$this->fileGrpsLoaded) { |
| 611 | 600 | $this->_getFileGrps(); |
@@ -616,8 +605,7 @@ discard block |
||
| 616 | 605 | * {@inheritDoc} |
| 617 | 606 | * @see Document::getParentDocumentUid() |
| 618 | 607 | */ |
| 619 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 620 | - { |
|
| 608 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 621 | 609 | $partof = 0; |
| 622 | 610 | // Get the closest ancestor of the current document which has a MPTR child. |
| 623 | 611 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -640,8 +628,7 @@ discard block |
||
| 640 | 628 | * {@inheritDoc} |
| 641 | 629 | * @see Document::setPreloadedDocument() |
| 642 | 630 | */ |
| 643 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 644 | - { |
|
| 631 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 645 | 632 | |
| 646 | 633 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 647 | 634 | $this->xml = $preloadedDocument; |
@@ -654,8 +641,7 @@ discard block |
||
| 654 | 641 | * {@inheritDoc} |
| 655 | 642 | * @see Document::getDocument() |
| 656 | 643 | */ |
| 657 | - protected function getDocument() |
|
| 658 | - { |
|
| 644 | + protected function getDocument() { |
|
| 659 | 645 | return $this->mets; |
| 660 | 646 | } |
| 661 | 647 | |
@@ -666,8 +652,7 @@ discard block |
||
| 666 | 652 | * |
| 667 | 653 | * @return integer The PID of the metadata definitions |
| 668 | 654 | */ |
| 669 | - protected function _getCPid() |
|
| 670 | - { |
|
| 655 | + protected function _getCPid() { |
|
| 671 | 656 | return $this->cPid; |
| 672 | 657 | } |
| 673 | 658 | |
@@ -678,8 +663,7 @@ discard block |
||
| 678 | 663 | * |
| 679 | 664 | * @return array Array of dmdSecs with their IDs as array key |
| 680 | 665 | */ |
| 681 | - protected function _getDmdSec() |
|
| 682 | - { |
|
| 666 | + protected function _getDmdSec() { |
|
| 683 | 667 | if (!$this->dmdSecLoaded) { |
| 684 | 668 | // Get available data formats. |
| 685 | 669 | $this->loadFormats(); |
@@ -715,8 +699,7 @@ discard block |
||
| 715 | 699 | * |
| 716 | 700 | * @return array Array of file use groups with file IDs |
| 717 | 701 | */ |
| 718 | - protected function _getFileGrps() |
|
| 719 | - { |
|
| 702 | + protected function _getFileGrps() { |
|
| 720 | 703 | if (!$this->fileGrpsLoaded) { |
| 721 | 704 | // Get configured USE attributes. |
| 722 | 705 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -759,8 +742,7 @@ discard block |
||
| 759 | 742 | * {@inheritDoc} |
| 760 | 743 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 761 | 744 | */ |
| 762 | - protected function prepareMetadataArray($cPid) |
|
| 763 | - { |
|
| 745 | + protected function prepareMetadataArray($cPid) { |
|
| 764 | 746 | // Get all logical structure nodes with metadata. |
| 765 | 747 | if (($ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'))) { |
| 766 | 748 | foreach ($ids as $id) { |
@@ -777,8 +759,7 @@ discard block |
||
| 777 | 759 | * |
| 778 | 760 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
| 779 | 761 | */ |
| 780 | - protected function _getMets() |
|
| 781 | - { |
|
| 762 | + protected function _getMets() { |
|
| 782 | 763 | return $this->mets; |
| 783 | 764 | } |
| 784 | 765 | |
@@ -786,8 +767,7 @@ discard block |
||
| 786 | 767 | * {@inheritDoc} |
| 787 | 768 | * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure() |
| 788 | 769 | */ |
| 789 | - protected function _getPhysicalStructure() |
|
| 790 | - { |
|
| 770 | + protected function _getPhysicalStructure() { |
|
| 791 | 771 | // Is there no physical structure array yet? |
| 792 | 772 | if (!$this->physicalStructureLoaded) { |
| 793 | 773 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -847,8 +827,7 @@ discard block |
||
| 847 | 827 | * {@inheritDoc} |
| 848 | 828 | * @see \Kitodo\Dlf\Common\Document::_getSmLinks() |
| 849 | 829 | */ |
| 850 | - protected function _getSmLinks() |
|
| 851 | - { |
|
| 830 | + protected function _getSmLinks() { |
|
| 852 | 831 | if (!$this->smLinksLoaded) { |
| 853 | 832 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
| 854 | 833 | foreach ($smLinks as $smLink) { |
@@ -864,8 +843,7 @@ discard block |
||
| 864 | 843 | * {@inheritDoc} |
| 865 | 844 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 866 | 845 | */ |
| 867 | - protected function _getThumbnail($forceReload = FALSE) |
|
| 868 | - { |
|
| 846 | + protected function _getThumbnail($forceReload = FALSE) { |
|
| 869 | 847 | if ( |
| 870 | 848 | !$this->thumbnailLoaded |
| 871 | 849 | || $forceReload |
@@ -939,8 +917,7 @@ discard block |
||
| 939 | 917 | * {@inheritDoc} |
| 940 | 918 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 941 | 919 | */ |
| 942 | - protected function _getToplevelId() |
|
| 943 | - { |
|
| 920 | + protected function _getToplevelId() { |
|
| 944 | 921 | if (empty($this->toplevelId)) { |
| 945 | 922 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
| 946 | 923 | if (($divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) { |
@@ -971,8 +948,7 @@ discard block |
||
| 971 | 948 | * |
| 972 | 949 | * @return array Properties to be serialized |
| 973 | 950 | */ |
| 974 | - public function __sleep() |
|
| 975 | - { |
|
| 951 | + public function __sleep() { |
|
| 976 | 952 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
| 977 | 953 | $this->asXML = $this->xml->asXML(); |
| 978 | 954 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -985,8 +961,7 @@ discard block |
||
| 985 | 961 | * |
| 986 | 962 | * @return string String representing the METS object |
| 987 | 963 | */ |
| 988 | - public function __toString() |
|
| 989 | - { |
|
| 964 | + public function __toString() { |
|
| 990 | 965 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 991 | 966 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
| 992 | 967 | $xml->formatOutput = TRUE; |
@@ -1001,8 +976,7 @@ discard block |
||
| 1001 | 976 | * |
| 1002 | 977 | * @return void |
| 1003 | 978 | */ |
| 1004 | - public function __wakeup() |
|
| 1005 | - { |
|
| 979 | + public function __wakeup() { |
|
| 1006 | 980 | // Turn off libxml's error logging. |
| 1007 | 981 | $libxmlErrors = libxml_use_internal_errors(TRUE); |
| 1008 | 982 | // Reload XML from string. |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | * @subpackage tx_dlf |
| 39 | 39 | * @access public |
| 40 | 40 | */ |
| 41 | -final class IiifManifest extends Document |
|
| 42 | -{ |
|
| 41 | +final class IiifManifest extends Document { |
|
| 43 | 42 | /** |
| 44 | 43 | * This holds the manifest file as string for serialization purposes |
| 45 | 44 | * @see __sleep() / __wakeup() |
@@ -100,8 +99,7 @@ discard block |
||
| 100 | 99 | * {@inheritDoc} |
| 101 | 100 | * @see Document::establishRecordId() |
| 102 | 101 | */ |
| 103 | - protected function establishRecordId($pid) |
|
| 104 | - { |
|
| 102 | + protected function establishRecordId($pid) { |
|
| 105 | 103 | if ($this->iiif !== NULL) { |
| 106 | 104 | /* |
| 107 | 105 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -141,8 +139,7 @@ discard block |
||
| 141 | 139 | * {@inheritDoc} |
| 142 | 140 | * @see Document::getDocument() |
| 143 | 141 | */ |
| 144 | - protected function getDocument() |
|
| 145 | - { |
|
| 142 | + protected function getDocument() { |
|
| 146 | 143 | return $this->iiif; |
| 147 | 144 | } |
| 148 | 145 | |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
| 156 | 153 | * the resource is a Presentation API 2 / 3 resource |
| 157 | 154 | */ |
| 158 | - public function getIiifVersion() |
|
| 159 | - { |
|
| 155 | + public function getIiifVersion() { |
|
| 160 | 156 | if (!isset($this->iiifVersion)) { |
| 161 | 157 | if ($this->iiif instanceof AbstractIiifResource1) { |
| 162 | 158 | $this->iiifVersion = 'IIIF1'; |
@@ -197,8 +193,7 @@ discard block |
||
| 197 | 193 | * |
| 198 | 194 | * @return array|string |
| 199 | 195 | */ |
| 200 | - protected function getUseGroups($use) |
|
| 201 | - { |
|
| 196 | + protected function getUseGroups($use) { |
|
| 202 | 197 | if (!$this->useGrpsLoaded) { |
| 203 | 198 | // Get configured USE attributes. |
| 204 | 199 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -225,8 +220,7 @@ discard block |
||
| 225 | 220 | * {@inheritDoc} |
| 226 | 221 | * @see Document::_getPhysicalStructure() |
| 227 | 222 | */ |
| 228 | - protected function _getPhysicalStructure() |
|
| 229 | - { |
|
| 223 | + protected function _getPhysicalStructure() { |
|
| 230 | 224 | // Is there no physical structure array yet? |
| 231 | 225 | if (!$this->physicalStructureLoaded) { |
| 232 | 226 | if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
@@ -347,8 +341,7 @@ discard block |
||
| 347 | 341 | * {@inheritDoc} |
| 348 | 342 | * @see Document::getDownloadLocation() |
| 349 | 343 | */ |
| 350 | - public function getDownloadLocation($id) |
|
| 351 | - { |
|
| 344 | + public function getDownloadLocation($id) { |
|
| 352 | 345 | $fileLocation = $this->getFileLocation($id); |
| 353 | 346 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
| 354 | 347 | if ($resource instanceof AbstractImageService) { |
@@ -361,8 +354,7 @@ discard block |
||
| 361 | 354 | * {@inheritDoc} |
| 362 | 355 | * @see Document::getFileLocation() |
| 363 | 356 | */ |
| 364 | - public function getFileLocation($id) |
|
| 365 | - { |
|
| 357 | + public function getFileLocation($id) { |
|
| 366 | 358 | if ($id == NULL) { |
| 367 | 359 | return NULL; |
| 368 | 360 | } |
@@ -386,8 +378,7 @@ discard block |
||
| 386 | 378 | * {@inheritDoc} |
| 387 | 379 | * @see Document::getFileMimeType() |
| 388 | 380 | */ |
| 389 | - public function getFileMimeType($id) |
|
| 390 | - { |
|
| 381 | + public function getFileMimeType($id) { |
|
| 391 | 382 | $fileResource = $this->iiif->getContainedResourceById($id); |
| 392 | 383 | if ($fileResource instanceof CanvasInterface) { |
| 393 | 384 | $format = "application/vnd.kitodo.iiif"; |
@@ -412,8 +403,7 @@ discard block |
||
| 412 | 403 | * {@inheritDoc} |
| 413 | 404 | * @see Document::getLogicalStructure() |
| 414 | 405 | */ |
| 415 | - public function getLogicalStructure($id, $recursive = FALSE) |
|
| 416 | - { |
|
| 406 | + public function getLogicalStructure($id, $recursive = FALSE) { |
|
| 417 | 407 | $details = []; |
| 418 | 408 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
| 419 | 409 | return $this->logicalUnits[$id]; |
@@ -448,8 +438,7 @@ discard block |
||
| 448 | 438 | * @param array $processedStructures: IIIF resources that already have been processed |
| 449 | 439 | * @return array Logical structure array |
| 450 | 440 | */ |
| 451 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = []) |
|
| 452 | - { |
|
| 441 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = []) { |
|
| 453 | 442 | $details = []; |
| 454 | 443 | $details['id'] = $resource->getId(); |
| 455 | 444 | $details['dmdId'] = ''; |
@@ -541,8 +530,7 @@ discard block |
||
| 541 | 530 | * |
| 542 | 531 | * @todo This method is still in experimental; the method signature may change. |
| 543 | 532 | */ |
| 544 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) |
|
| 545 | - { |
|
| 533 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) { |
|
| 546 | 534 | if (!empty($this->originalMetadataArray[$id])) { |
| 547 | 535 | return $this->originalMetadataArray[$id]; |
| 548 | 536 | } |
@@ -584,8 +572,7 @@ discard block |
||
| 584 | 572 | * {@inheritDoc} |
| 585 | 573 | * @see Document::getMetadata() |
| 586 | 574 | */ |
| 587 | - public function getMetadata($id, $cPid = 0) |
|
| 588 | - { |
|
| 575 | + public function getMetadata($id, $cPid = 0) { |
|
| 589 | 576 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
| 590 | 577 | return $this->metadataArray[$id]; |
| 591 | 578 | } |
@@ -669,8 +656,7 @@ discard block |
||
| 669 | 656 | * {@inheritDoc} |
| 670 | 657 | * @see Document::_getSmLinks() |
| 671 | 658 | */ |
| 672 | - protected function _getSmLinks() |
|
| 673 | - { |
|
| 659 | + protected function _getSmLinks() { |
|
| 674 | 660 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
| 675 | 661 | if (!empty($this->iiif->getDefaultCanvases())) { |
| 676 | 662 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -694,8 +680,7 @@ discard block |
||
| 694 | 680 | * |
| 695 | 681 | * @param RangeInterface $range: Current range whose canvases shall be linked |
| 696 | 682 | */ |
| 697 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
| 698 | - { |
|
| 683 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
| 699 | 684 | // map range's canvases including all child ranges' canvases |
| 700 | 685 | if (!$range->isTopRange()) { |
| 701 | 686 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -718,8 +703,7 @@ discard block |
||
| 718 | 703 | * @param CanvasInterface $canvas |
| 719 | 704 | * @param IiifResourceInterface $resource |
| 720 | 705 | */ |
| 721 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
| 722 | - { |
|
| 706 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
| 723 | 707 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
| 724 | 708 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
| 725 | 709 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -734,8 +718,7 @@ discard block |
||
| 734 | 718 | * |
| 735 | 719 | * @see Document::getParentDocumentUidForSaving() |
| 736 | 720 | */ |
| 737 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 738 | - { |
|
| 721 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 739 | 722 | // Do nothing. |
| 740 | 723 | } |
| 741 | 724 | |
@@ -743,8 +726,7 @@ discard block |
||
| 743 | 726 | * {@inheritDoc} |
| 744 | 727 | * @see Document::getRawText() |
| 745 | 728 | */ |
| 746 | - public function getRawText($id) |
|
| 747 | - { |
|
| 729 | + public function getRawText($id) { |
|
| 748 | 730 | $rawText = ''; |
| 749 | 731 | // Get text from raw text array if available. |
| 750 | 732 | if (!empty($this->rawTextArray[$id])) { |
@@ -797,8 +779,7 @@ discard block |
||
| 797 | 779 | * |
| 798 | 780 | * @return IiifResourceInterface |
| 799 | 781 | */ |
| 800 | - public function getIiif() |
|
| 801 | - { |
|
| 782 | + public function getIiif() { |
|
| 802 | 783 | return $this->iiif; |
| 803 | 784 | } |
| 804 | 785 | |
@@ -806,8 +787,7 @@ discard block |
||
| 806 | 787 | * {@inheritDoc} |
| 807 | 788 | * @see Document::init() |
| 808 | 789 | */ |
| 809 | - protected function init() |
|
| 810 | - { |
|
| 790 | + protected function init() { |
|
| 811 | 791 | // Nothing to do here, at the moment |
| 812 | 792 | } |
| 813 | 793 | |
@@ -815,8 +795,7 @@ discard block |
||
| 815 | 795 | * {@inheritDoc} |
| 816 | 796 | * @see Document::loadLocation() |
| 817 | 797 | */ |
| 818 | - protected function loadLocation($location) |
|
| 819 | - { |
|
| 798 | + protected function loadLocation($location) { |
|
| 820 | 799 | $content = GeneralUtility::getUrl($location); |
| 821 | 800 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 822 | 801 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -837,8 +816,7 @@ discard block |
||
| 837 | 816 | * {@inheritDoc} |
| 838 | 817 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 839 | 818 | */ |
| 840 | - protected function prepareMetadataArray($cPid) |
|
| 841 | - { |
|
| 819 | + protected function prepareMetadataArray($cPid) { |
|
| 842 | 820 | $id = $this->iiif->getId(); |
| 843 | 821 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
| 844 | 822 | } |
@@ -847,8 +825,7 @@ discard block |
||
| 847 | 825 | * {@inheritDoc} |
| 848 | 826 | * @see Document::setPreloadedDocument() |
| 849 | 827 | */ |
| 850 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 851 | - { |
|
| 828 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 852 | 829 | if ($preloadedDocument instanceof ManifestInterface) { |
| 853 | 830 | $this->iiif = $preloadedDocument; |
| 854 | 831 | return TRUE; |
@@ -860,8 +837,7 @@ discard block |
||
| 860 | 837 | * {@inheritDoc} |
| 861 | 838 | * @see Document::ensureHasFulltextIsSet() |
| 862 | 839 | */ |
| 863 | - protected function ensureHasFulltextIsSet() |
|
| 864 | - { |
|
| 840 | + protected function ensureHasFulltextIsSet() { |
|
| 865 | 841 | /* |
| 866 | 842 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
| 867 | 843 | * Example: |
@@ -907,8 +883,7 @@ discard block |
||
| 907 | 883 | * {@inheritDoc} |
| 908 | 884 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 909 | 885 | */ |
| 910 | - protected function _getThumbnail($forceReload = FALSE) |
|
| 911 | - { |
|
| 886 | + protected function _getThumbnail($forceReload = FALSE) { |
|
| 912 | 887 | return $this->iiif->getThumbnailUrl(); |
| 913 | 888 | } |
| 914 | 889 | |
@@ -916,8 +891,7 @@ discard block |
||
| 916 | 891 | * {@inheritDoc} |
| 917 | 892 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 918 | 893 | */ |
| 919 | - protected function _getToplevelId() |
|
| 920 | - { |
|
| 894 | + protected function _getToplevelId() { |
|
| 921 | 895 | if (empty($this->toplevelId)) { |
| 922 | 896 | if (isset($this->iiif)) { |
| 923 | 897 | $this->toplevelId = $this->iiif->getId(); |
@@ -934,8 +908,7 @@ discard block |
||
| 934 | 908 | * |
| 935 | 909 | * @return void |
| 936 | 910 | */ |
| 937 | - public function __wakeup() |
|
| 938 | - { |
|
| 911 | + public function __wakeup() { |
|
| 939 | 912 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 940 | 913 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 941 | 914 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -954,8 +927,7 @@ discard block |
||
| 954 | 927 | * |
| 955 | 928 | * @return string[] |
| 956 | 929 | */ |
| 957 | - public function __sleep() |
|
| 958 | - { |
|
| 930 | + public function __sleep() { |
|
| 959 | 931 | // TODO implement serializiation in IIIF library |
| 960 | 932 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
| 961 | 933 | $this->asJson = json_encode($jsonArray); |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class Helper |
|
| 29 | -{ |
|
| 28 | +class Helper { |
|
| 30 | 29 | /** |
| 31 | 30 | * The extension key |
| 32 | 31 | * |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | * |
| 57 | 56 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 58 | 57 | */ |
| 59 | - public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
| 60 | - { |
|
| 58 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') { |
|
| 61 | 59 | $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 62 | 60 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 63 | 61 | $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
@@ -82,8 +80,7 @@ discard block |
||
| 82 | 80 | * |
| 83 | 81 | * @return boolean Is $id a valid GNL identifier of the given $type? |
| 84 | 82 | */ |
| 85 | - public static function checkIdentifier($id, $type) |
|
| 86 | - { |
|
| 83 | + public static function checkIdentifier($id, $type) { |
|
| 87 | 84 | $digits = substr($id, 0, 8); |
| 88 | 85 | $checksum = 0; |
| 89 | 86 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -148,8 +145,7 @@ discard block |
||
| 148 | 145 | * |
| 149 | 146 | * @return mixed The decrypted value or NULL on error |
| 150 | 147 | */ |
| 151 | - public static function decrypt($encrypted, $hash) |
|
| 152 | - { |
|
| 148 | + public static function decrypt($encrypted, $hash) { |
|
| 153 | 149 | $decrypted = NULL; |
| 154 | 150 | if ( |
| 155 | 151 | empty($encrypted) |
@@ -184,8 +180,7 @@ discard block |
||
| 184 | 180 | * |
| 185 | 181 | * @return void |
| 186 | 182 | */ |
| 187 | - public static function devLog($message, $severity = 0) |
|
| 188 | - { |
|
| 183 | + public static function devLog($message, $severity = 0) { |
|
| 189 | 184 | if (TYPO3_DLOG) { |
| 190 | 185 | $stacktrace = debug_backtrace(0, 2); |
| 191 | 186 | // Set some defaults. |
@@ -225,8 +220,7 @@ discard block |
||
| 225 | 220 | * |
| 226 | 221 | * @return array Array with encrypted string and control hash |
| 227 | 222 | */ |
| 228 | - public static function encrypt($string) |
|
| 229 | - { |
|
| 223 | + public static function encrypt($string) { |
|
| 230 | 224 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 231 | 225 | self::devLog('No encryption key set in TYPO3 configuration', DEVLOG_SEVERITY_ERROR); |
| 232 | 226 | return; |
@@ -247,8 +241,7 @@ discard block |
||
| 247 | 241 | * |
| 248 | 242 | * @return string The unqualified class name |
| 249 | 243 | */ |
| 250 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 251 | - { |
|
| 244 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 252 | 245 | $nameParts = explode('\\', $qualifiedClassname); |
| 253 | 246 | return end($nameParts); |
| 254 | 247 | } |
@@ -262,8 +255,7 @@ discard block |
||
| 262 | 255 | * |
| 263 | 256 | * @return string The cleaned up string |
| 264 | 257 | */ |
| 265 | - public static function getCleanString($string) |
|
| 266 | - { |
|
| 258 | + public static function getCleanString($string) { |
|
| 267 | 259 | // Convert to lowercase. |
| 268 | 260 | $string = strtolower($string); |
| 269 | 261 | // Remove non-alphanumeric characters. |
@@ -284,8 +276,7 @@ discard block |
||
| 284 | 276 | * |
| 285 | 277 | * @return array Array of hook objects for the class |
| 286 | 278 | */ |
| 287 | - public static function getHookObjects($scriptRelPath) |
|
| 288 | - { |
|
| 279 | + public static function getHookObjects($scriptRelPath) { |
|
| 289 | 280 | $hookObjects = []; |
| 290 | 281 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 291 | 282 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -306,8 +297,7 @@ discard block |
||
| 306 | 297 | * |
| 307 | 298 | * @return string "index_name" for the given UID |
| 308 | 299 | */ |
| 309 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 310 | - { |
|
| 300 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 311 | 301 | // Sanitize input. |
| 312 | 302 | $uid = max(intval($uid), 0); |
| 313 | 303 | if ( |
@@ -358,8 +348,7 @@ discard block |
||
| 358 | 348 | * |
| 359 | 349 | * @return string Localized full name of language or unchanged input |
| 360 | 350 | */ |
| 361 | - public static function getLanguageName($code) |
|
| 362 | - { |
|
| 351 | + public static function getLanguageName($code) { |
|
| 363 | 352 | // Analyze code and set appropriate ISO table. |
| 364 | 353 | $isoCode = strtolower(trim($code)); |
| 365 | 354 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -404,8 +393,7 @@ discard block |
||
| 404 | 393 | * |
| 405 | 394 | * @return string The translated string or the given key on failure |
| 406 | 395 | */ |
| 407 | - public static function getMessage($key, $hsc = FALSE, $default = '') |
|
| 408 | - { |
|
| 396 | + public static function getMessage($key, $hsc = FALSE, $default = '') { |
|
| 409 | 397 | // Set initial output to default value. |
| 410 | 398 | $translated = (string) $default; |
| 411 | 399 | // Load common messages file. |
@@ -447,8 +435,7 @@ discard block |
||
| 447 | 435 | * |
| 448 | 436 | * @return string "uid" for the given index_name |
| 449 | 437 | */ |
| 450 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
| 451 | - { |
|
| 438 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
| 452 | 439 | if ( |
| 453 | 440 | !$index_name |
| 454 | 441 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -500,8 +487,7 @@ discard block |
||
| 500 | 487 | * |
| 501 | 488 | * @return string Uniform Resource Name as string |
| 502 | 489 | */ |
| 503 | - public static function getURN($base, $id) |
|
| 504 | - { |
|
| 490 | + public static function getURN($base, $id) { |
|
| 505 | 491 | $concordance = [ |
| 506 | 492 | '0' => 1, |
| 507 | 493 | '1' => 2, |
@@ -568,8 +554,7 @@ discard block |
||
| 568 | 554 | * |
| 569 | 555 | * @return boolean Is $id a valid PPN? |
| 570 | 556 | */ |
| 571 | - public static function isPPN($id) |
|
| 572 | - { |
|
| 557 | + public static function isPPN($id) { |
|
| 573 | 558 | return self::checkIdentifier($id, 'PPN'); |
| 574 | 559 | } |
| 575 | 560 | |
@@ -582,8 +567,7 @@ discard block |
||
| 582 | 567 | * |
| 583 | 568 | * @return mixed Session value for given key or NULL on failure |
| 584 | 569 | */ |
| 585 | - public static function loadFromSession($key) |
|
| 586 | - { |
|
| 570 | + public static function loadFromSession($key) { |
|
| 587 | 571 | // Cast to string for security reasons. |
| 588 | 572 | $key = (string) $key; |
| 589 | 573 | if (!$key) { |
@@ -615,8 +599,7 @@ discard block |
||
| 615 | 599 | * |
| 616 | 600 | * @return array Merged array |
| 617 | 601 | */ |
| 618 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
| 619 | - { |
|
| 602 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) { |
|
| 620 | 603 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 621 | 604 | return $original; |
| 622 | 605 | } |
@@ -633,8 +616,7 @@ discard block |
||
| 633 | 616 | * |
| 634 | 617 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 635 | 618 | */ |
| 636 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
| 637 | - { |
|
| 619 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) { |
|
| 638 | 620 | if ( |
| 639 | 621 | TYPO3_MODE === 'BE' |
| 640 | 622 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -678,8 +660,7 @@ discard block |
||
| 678 | 660 | * |
| 679 | 661 | * @return string All flash messages in the queue rendered as HTML. |
| 680 | 662 | */ |
| 681 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 682 | - { |
|
| 663 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 683 | 664 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 684 | 665 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 685 | 666 | // \TYPO3\CMS\Core\Messaging\FlashMessage::getMessageAsMarkup() uses htmlspecialchars() |
@@ -725,8 +706,7 @@ discard block |
||
| 725 | 706 | * |
| 726 | 707 | * @return boolean TRUE on success, FALSE on failure |
| 727 | 708 | */ |
| 728 | - public static function saveToSession($value, $key) |
|
| 729 | - { |
|
| 709 | + public static function saveToSession($value, $key) { |
|
| 730 | 710 | // Cast to string for security reasons. |
| 731 | 711 | $key = (string) $key; |
| 732 | 712 | if (!$key) { |
@@ -758,8 +738,7 @@ discard block |
||
| 758 | 738 | * |
| 759 | 739 | * @return string Localized label for $index_name |
| 760 | 740 | */ |
| 761 | - public static function translate($index_name, $table, $pid) |
|
| 762 | - { |
|
| 741 | + public static function translate($index_name, $table, $pid) { |
|
| 763 | 742 | // Load labels into static variable for future use. |
| 764 | 743 | static $labels = []; |
| 765 | 744 | // Sanitize input. |
@@ -883,8 +862,7 @@ discard block |
||
| 883 | 862 | * |
| 884 | 863 | * @return string Additional WHERE clause |
| 885 | 864 | */ |
| 886 | - public static function whereClause($table, $showHidden = FALSE) |
|
| 887 | - { |
|
| 865 | + public static function whereClause($table, $showHidden = FALSE) { |
|
| 888 | 866 | if (TYPO3_MODE === 'FE') { |
| 889 | 867 | // Table "tx_dlf_formats" always has PID 0. |
| 890 | 868 | if ($table == 'tx_dlf_formats') { |
@@ -921,8 +899,7 @@ discard block |
||
| 921 | 899 | * |
| 922 | 900 | * @return string Additional WHERE expression |
| 923 | 901 | */ |
| 924 | - public static function whereExpression($table, $showHidden = FALSE) |
|
| 925 | - { |
|
| 902 | + public static function whereExpression($table, $showHidden = FALSE) { |
|
| 926 | 903 | $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 927 | 904 | ->getQueryBuilderForTable($table) |
| 928 | 905 | ->expr(); |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class DocumentTypeCheck |
|
| 29 | -{ |
|
| 28 | +class DocumentTypeCheck { |
|
| 30 | 29 | /** |
| 31 | 30 | * This holds the current document |
| 32 | 31 | * |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | * |
| 68 | 67 | * @return string The type of the current document |
| 69 | 68 | */ |
| 70 | - public function getDocType() |
|
| 71 | - { |
|
| 69 | + public function getDocType() { |
|
| 72 | 70 | // Load current document. |
| 73 | 71 | $this->loadDocument(); |
| 74 | 72 | if ($this->doc === NULL) { |
@@ -151,8 +149,7 @@ discard block |
||
| 151 | 149 | * |
| 152 | 150 | * @return void |
| 153 | 151 | */ |
| 154 | - protected function loadDocument() |
|
| 155 | - { |
|
| 152 | + protected function loadDocument() { |
|
| 156 | 153 | // Check for required variable. |
| 157 | 154 | if (!empty($this->piVars['id'])) { |
| 158 | 155 | // Get instance of \Kitodo\Dlf\Common\Document. |
@@ -199,8 +196,7 @@ discard block |
||
| 199 | 196 | * |
| 200 | 197 | * @return void |
| 201 | 198 | */ |
| 202 | - public function __construct() |
|
| 203 | - { |
|
| 199 | + public function __construct() { |
|
| 204 | 200 | // Load current plugin parameters. |
| 205 | 201 | $this->piVars = GeneralUtility::_GPmerged($this->prefixId); |
| 206 | 202 | } |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | * @access public |
| 22 | 22 | * @abstract |
| 23 | 23 | */ |
| 24 | -interface MetadataInterface |
|
| 25 | -{ |
|
| 24 | +interface MetadataInterface { |
|
| 26 | 25 | /** |
| 27 | 26 | * This extracts metadata from XML |
| 28 | 27 | * |