We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 194 |
| Total Lines | 1162 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
Complex classes like MetsDocument often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use MetsDocument, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 51 | final class MetsDocument extends Doc |
||
| 52 | { |
||
| 53 | /** |
||
| 54 | * This holds the whole XML file as string for serialization purposes |
||
| 55 | * @see __sleep() / __wakeup() |
||
| 56 | * |
||
| 57 | * @var string |
||
| 58 | * @access protected |
||
| 59 | */ |
||
| 60 | protected $asXML = ''; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * This holds the XML file's dmdSec parts with their IDs as array key |
||
| 64 | * |
||
| 65 | * @var array |
||
| 66 | * @access protected |
||
| 67 | */ |
||
| 68 | protected $dmdSec = []; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Are the METS file's dmdSecs loaded? |
||
| 72 | * @see $dmdSec |
||
| 73 | * |
||
| 74 | * @var bool |
||
| 75 | * @access protected |
||
| 76 | */ |
||
| 77 | protected $dmdSecLoaded = false; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * The extension key |
||
| 81 | * |
||
| 82 | * @var string |
||
| 83 | * @access public |
||
| 84 | */ |
||
| 85 | public static $extKey = 'dlf'; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * This holds the file ID -> USE concordance |
||
| 89 | * @see _getFileGrps() |
||
| 90 | * |
||
| 91 | * @var array |
||
| 92 | * @access protected |
||
| 93 | */ |
||
| 94 | protected $fileGrps = []; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Are the image file groups loaded? |
||
| 98 | * @see $fileGrps |
||
| 99 | * |
||
| 100 | * @var bool |
||
| 101 | * @access protected |
||
| 102 | */ |
||
| 103 | protected $fileGrpsLoaded = false; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * This holds the XML file's METS part as \SimpleXMLElement object |
||
| 107 | * |
||
| 108 | * @var \SimpleXMLElement |
||
| 109 | * @access protected |
||
| 110 | */ |
||
| 111 | protected $mets; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * This holds the whole XML file as \SimpleXMLElement object |
||
| 115 | * |
||
| 116 | * @var \SimpleXMLElement |
||
| 117 | * @access protected |
||
| 118 | */ |
||
| 119 | protected $xml; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * This adds metadata from METS structural map to metadata array. |
||
| 123 | * |
||
| 124 | * @access public |
||
| 125 | * |
||
| 126 | * @param array &$metadata: The metadata array to extend |
||
| 127 | * @param string $id: The @ID attribute of the logical structure node |
||
| 128 | * |
||
| 129 | * @return void |
||
| 130 | */ |
||
| 131 | public function addMetadataFromMets(&$metadata, $id) |
||
| 132 | { |
||
| 133 | $details = $this->getLogicalStructure($id); |
||
| 134 | if (!empty($details)) { |
||
| 135 | $metadata['mets_order'][0] = $details['order']; |
||
| 136 | $metadata['mets_label'][0] = $details['label']; |
||
| 137 | $metadata['mets_orderlabel'][0] = $details['orderlabel']; |
||
| 138 | } |
||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * |
||
| 143 | * {@inheritDoc} |
||
| 144 | * @see \Kitodo\Dlf\Common\Doc::establishRecordId() |
||
| 145 | */ |
||
| 146 | protected function establishRecordId($pid) |
||
| 147 | { |
||
| 148 | // Check for METS object @ID. |
||
| 149 | if (!empty($this->mets['OBJID'])) { |
||
| 150 | $this->recordId = (string) $this->mets['OBJID']; |
||
| 151 | } |
||
| 152 | // Get hook objects. |
||
| 153 | $hookObjects = Helper::getHookObjects('Classes/Common/MetsDocument.php'); |
||
| 154 | // Apply hooks. |
||
| 155 | foreach ($hookObjects as $hookObj) { |
||
| 156 | if (method_exists($hookObj, 'construct_postProcessRecordId')) { |
||
| 157 | $hookObj->construct_postProcessRecordId($this->xml, $this->recordId); |
||
| 158 | } |
||
| 159 | } |
||
| 160 | } |
||
| 161 | |||
| 162 | /** |
||
| 163 | * |
||
| 164 | * {@inheritDoc} |
||
| 165 | * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation() |
||
| 166 | */ |
||
| 167 | public function getDownloadLocation($id) |
||
| 168 | { |
||
| 169 | $fileMimeType = $this->getFileMimeType($id); |
||
| 170 | $fileLocation = $this->getFileLocation($id); |
||
| 171 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
||
| 172 | $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json'); |
||
| 173 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
||
| 174 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
||
| 175 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
||
| 176 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
||
| 177 | $service = IiifHelper::loadIiifResource($fileLocation); |
||
| 178 | if ($service !== null && $service instanceof AbstractImageService) { |
||
| 179 | return $service->getImageUrl(); |
||
| 180 | } |
||
| 181 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
||
| 182 | $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
||
| 183 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
||
| 184 | return $baseURL . '&CVT=jpeg'; |
||
| 185 | } |
||
| 186 | return $fileLocation; |
||
| 187 | } |
||
| 188 | |||
| 189 | /** |
||
| 190 | * {@inheritDoc} |
||
| 191 | * @see \Kitodo\Dlf\Common\Doc::getFileLocation() |
||
| 192 | */ |
||
| 193 | public function getFileLocation($id) |
||
| 194 | { |
||
| 195 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
||
| 196 | if ( |
||
| 197 | !empty($id) |
||
| 198 | && !empty($location) |
||
| 199 | ) { |
||
| 200 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
||
| 201 | } else { |
||
| 202 | $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
||
| 203 | return ''; |
||
| 204 | } |
||
| 205 | } |
||
| 206 | |||
| 207 | /** |
||
| 208 | * {@inheritDoc} |
||
| 209 | * @see \Kitodo\Dlf\Common\Doc::getFileMimeType() |
||
| 210 | */ |
||
| 211 | public function getFileMimeType($id) |
||
| 212 | { |
||
| 213 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
||
| 214 | if ( |
||
| 215 | !empty($id) |
||
| 216 | && !empty($mimetype) |
||
| 217 | ) { |
||
| 218 | return (string) $mimetype[0]; |
||
| 219 | } else { |
||
| 220 | $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
||
| 221 | return ''; |
||
| 222 | } |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
| 226 | * {@inheritDoc} |
||
| 227 | * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure() |
||
| 228 | */ |
||
| 229 | public function getLogicalStructure($id, $recursive = false) |
||
| 230 | { |
||
| 231 | $details = []; |
||
| 232 | // Is the requested logical unit already loaded? |
||
| 233 | if ( |
||
| 234 | !$recursive |
||
| 235 | && !empty($this->logicalUnits[$id]) |
||
| 236 | ) { |
||
| 237 | // Yes. Return it. |
||
| 238 | return $this->logicalUnits[$id]; |
||
| 239 | } elseif (!empty($id)) { |
||
| 240 | // Get specified logical unit. |
||
| 241 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
||
| 242 | } else { |
||
| 243 | // Get all logical units at top level. |
||
| 244 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
||
| 245 | } |
||
| 246 | if (!empty($divs)) { |
||
| 247 | if (!$recursive) { |
||
| 248 | // Get the details for the first xpath hit. |
||
| 249 | $details = $this->getLogicalStructureInfo($divs[0]); |
||
| 250 | } else { |
||
| 251 | // Walk the logical structure recursively and fill the whole table of contents. |
||
| 252 | foreach ($divs as $div) { |
||
| 253 | $this->tableOfContents[] = $this->getLogicalStructureInfo($div, $recursive); |
||
| 254 | } |
||
| 255 | } |
||
| 256 | } |
||
| 257 | return $details; |
||
| 258 | } |
||
| 259 | |||
| 260 | /** |
||
| 261 | * This gets details about a logical structure element |
||
| 262 | * |
||
| 263 | * @access protected |
||
| 264 | * |
||
| 265 | * @param \SimpleXMLElement $structure: The logical structure node |
||
| 266 | * @param bool $recursive: Whether to include the child elements |
||
| 267 | * |
||
| 268 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
||
| 269 | */ |
||
| 270 | protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
||
| 363 | } |
||
| 364 | |||
| 365 | /** |
||
| 366 | * {@inheritDoc} |
||
| 367 | * @see \Kitodo\Dlf\Common\Doc::getMetadata() |
||
| 368 | */ |
||
| 369 | public function getMetadata($id, $cPid = 0) |
||
| 370 | { |
||
| 371 | // Make sure $cPid is a non-negative integer. |
||
| 372 | $cPid = max(intval($cPid), 0); |
||
| 373 | // If $cPid is not given, try to get it elsewhere. |
||
| 374 | if ( |
||
| 375 | !$cPid |
||
| 376 | && ($this->cPid || $this->pid) |
||
| 377 | ) { |
||
| 378 | // Retain current PID. |
||
| 379 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
||
| 380 | } elseif (!$cPid) { |
||
| 381 | $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions'); |
||
| 382 | return []; |
||
| 383 | } |
||
| 384 | // Get metadata from parsed metadata array if available. |
||
| 385 | if ( |
||
| 386 | !empty($this->metadataArray[$id]) |
||
| 387 | && $this->metadataArray[0] == $cPid |
||
| 388 | ) { |
||
| 389 | return $this->metadataArray[$id]; |
||
| 390 | } |
||
| 391 | // Initialize metadata array with empty values. |
||
| 392 | $metadata = [ |
||
| 393 | 'title' => [], |
||
| 394 | 'title_sorting' => [], |
||
| 395 | 'author' => [], |
||
| 396 | 'place' => [], |
||
| 397 | 'year' => [], |
||
| 398 | 'prod_id' => [], |
||
| 399 | 'record_id' => [], |
||
| 400 | 'opac_id' => [], |
||
| 401 | 'union_id' => [], |
||
| 402 | 'urn' => [], |
||
| 403 | 'purl' => [], |
||
| 404 | 'type' => [], |
||
| 405 | 'volume' => [], |
||
| 406 | 'volume_sorting' => [], |
||
| 407 | 'license' => [], |
||
| 408 | 'terms' => [], |
||
| 409 | 'restrictions' => [], |
||
| 410 | 'out_of_print' => [], |
||
| 411 | 'rights_info' => [], |
||
| 412 | 'collection' => [], |
||
| 413 | 'owner' => [], |
||
| 414 | 'mets_label' => [], |
||
| 415 | 'mets_orderlabel' => [], |
||
| 416 | 'document_format' => ['METS'], |
||
| 417 | ]; |
||
| 418 | // Get the logical structure node's @DMDID. |
||
| 419 | if (!empty($this->logicalUnits[$id])) { |
||
| 420 | $dmdIds = $this->logicalUnits[$id]['dmdId']; |
||
| 421 | } else { |
||
| 422 | $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@DMDID'); |
||
| 423 | $dmdIds = (string) $dmdIds[0]; |
||
| 424 | } |
||
| 425 | if (!empty($dmdIds)) { |
||
| 426 | // Handle multiple DMDIDs separately. |
||
| 427 | $dmdIds = explode(' ', $dmdIds); |
||
| 428 | $hasSupportedMetadata = false; |
||
| 429 | } else { |
||
| 430 | // There is no dmdSec for this structure node. |
||
| 431 | return []; |
||
| 432 | } |
||
| 433 | // Load available metadata formats and dmdSecs. |
||
| 434 | $this->loadFormats(); |
||
| 435 | $this->_getDmdSec(); |
||
| 436 | foreach ($dmdIds as $dmdId) { |
||
| 437 | // Is this metadata format supported? |
||
| 438 | if (!empty($this->formats[$this->dmdSec[$dmdId]['type']])) { |
||
| 439 | if (!empty($this->formats[$this->dmdSec[$dmdId]['type']]['class'])) { |
||
| 440 | $class = $this->formats[$this->dmdSec[$dmdId]['type']]['class']; |
||
| 441 | // Get the metadata from class. |
||
| 442 | if ( |
||
| 443 | class_exists($class) |
||
| 444 | && ($obj = GeneralUtility::makeInstance($class)) instanceof MetadataInterface |
||
| 445 | ) { |
||
| 446 | $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata); |
||
| 447 | } else { |
||
| 448 | $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"'); |
||
| 449 | } |
||
| 450 | } |
||
| 451 | } else { |
||
| 452 | $this->logger->notice('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"'); |
||
| 453 | // Continue searching for supported metadata with next @DMDID. |
||
| 454 | continue; |
||
| 455 | } |
||
| 456 | // Get the structure's type. |
||
| 457 | if (!empty($this->logicalUnits[$id])) { |
||
| 458 | $metadata['type'] = [$this->logicalUnits[$id]['type']]; |
||
| 459 | } else { |
||
| 460 | $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
||
| 461 | if (!empty($struct)) { |
||
| 462 | $metadata['type'] = [(string) $struct[0]]; |
||
| 463 | } |
||
| 464 | } |
||
| 465 | // Get the additional metadata from database. |
||
| 466 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 467 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
||
| 468 | // Get hidden records, too. |
||
| 469 | $queryBuilder |
||
| 470 | ->getRestrictions() |
||
| 471 | ->removeByType(HiddenRestriction::class); |
||
| 472 | // Get all metadata with configured xpath and applicable format first. |
||
| 473 | $resultWithFormat = $queryBuilder |
||
| 474 | ->select( |
||
| 475 | 'tx_dlf_metadata.index_name AS index_name', |
||
| 476 | 'tx_dlf_metadataformat_joins.xpath AS xpath', |
||
| 477 | 'tx_dlf_metadataformat_joins.xpath_sorting AS xpath_sorting', |
||
| 478 | 'tx_dlf_metadata.is_sortable AS is_sortable', |
||
| 479 | 'tx_dlf_metadata.default_value AS default_value', |
||
| 480 | 'tx_dlf_metadata.format AS format' |
||
| 481 | ) |
||
| 482 | ->from('tx_dlf_metadata') |
||
| 483 | ->innerJoin( |
||
| 484 | 'tx_dlf_metadata', |
||
| 485 | 'tx_dlf_metadataformat', |
||
| 486 | 'tx_dlf_metadataformat_joins', |
||
| 487 | $queryBuilder->expr()->eq( |
||
| 488 | 'tx_dlf_metadataformat_joins.parent_id', |
||
| 489 | 'tx_dlf_metadata.uid' |
||
| 490 | ) |
||
| 491 | ) |
||
| 492 | ->innerJoin( |
||
| 493 | 'tx_dlf_metadataformat_joins', |
||
| 494 | 'tx_dlf_formats', |
||
| 495 | 'tx_dlf_formats_joins', |
||
| 496 | $queryBuilder->expr()->eq( |
||
| 497 | 'tx_dlf_formats_joins.uid', |
||
| 498 | 'tx_dlf_metadataformat_joins.encoded' |
||
| 499 | ) |
||
| 500 | ) |
||
| 501 | ->where( |
||
| 502 | $queryBuilder->expr()->eq('tx_dlf_metadata.pid', intval($cPid)), |
||
| 503 | $queryBuilder->expr()->eq('tx_dlf_metadata.l18n_parent', 0), |
||
| 504 | $queryBuilder->expr()->eq('tx_dlf_metadataformat_joins.pid', intval($cPid)), |
||
| 505 | $queryBuilder->expr()->eq('tx_dlf_formats_joins.type', $queryBuilder->createNamedParameter($this->dmdSec[$dmdId]['type'])) |
||
| 506 | ) |
||
| 507 | ->execute(); |
||
| 508 | // Get all metadata without a format, but with a default value next. |
||
| 509 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 510 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
||
| 511 | // Get hidden records, too. |
||
| 512 | $queryBuilder |
||
| 513 | ->getRestrictions() |
||
| 514 | ->removeByType(HiddenRestriction::class); |
||
| 515 | $resultWithoutFormat = $queryBuilder |
||
| 516 | ->select( |
||
| 517 | 'tx_dlf_metadata.index_name AS index_name', |
||
| 518 | 'tx_dlf_metadata.is_sortable AS is_sortable', |
||
| 519 | 'tx_dlf_metadata.default_value AS default_value', |
||
| 520 | 'tx_dlf_metadata.format AS format' |
||
| 521 | ) |
||
| 522 | ->from('tx_dlf_metadata') |
||
| 523 | ->where( |
||
| 524 | $queryBuilder->expr()->eq('tx_dlf_metadata.pid', intval($cPid)), |
||
| 525 | $queryBuilder->expr()->eq('tx_dlf_metadata.l18n_parent', 0), |
||
| 526 | $queryBuilder->expr()->eq('tx_dlf_metadata.format', 0), |
||
| 527 | $queryBuilder->expr()->neq('tx_dlf_metadata.default_value', $queryBuilder->createNamedParameter('')) |
||
| 528 | ) |
||
| 529 | ->execute(); |
||
| 530 | // Merge both result sets. |
||
| 531 | $allResults = array_merge($resultWithFormat->fetchAll(), $resultWithoutFormat->fetchAll()); |
||
| 532 | // We need a \DOMDocument here, because SimpleXML doesn't support XPath functions properly. |
||
| 533 | $domNode = dom_import_simplexml($this->dmdSec[$dmdId]['xml']); |
||
| 534 | $domXPath = new \DOMXPath($domNode->ownerDocument); |
||
| 535 | $this->registerNamespaces($domXPath); |
||
| 536 | // OK, now make the XPath queries. |
||
| 537 | foreach ($allResults as $resArray) { |
||
| 538 | // Set metadata field's value(s). |
||
| 539 | if ( |
||
| 540 | $resArray['format'] > 0 |
||
| 541 | && !empty($resArray['xpath']) |
||
| 542 | && ($values = $domXPath->evaluate($resArray['xpath'], $domNode)) |
||
| 543 | ) { |
||
| 544 | if ( |
||
| 545 | $values instanceof \DOMNodeList |
||
| 546 | && $values->length > 0 |
||
| 547 | ) { |
||
| 548 | $metadata[$resArray['index_name']] = []; |
||
| 549 | foreach ($values as $value) { |
||
| 550 | $metadata[$resArray['index_name']][] = trim((string) $value->nodeValue); |
||
| 551 | } |
||
| 552 | } elseif (!($values instanceof \DOMNodeList)) { |
||
| 553 | $metadata[$resArray['index_name']] = [trim((string) $values)]; |
||
| 554 | } |
||
| 555 | } |
||
| 556 | // Set default value if applicable. |
||
| 557 | if ( |
||
| 558 | empty($metadata[$resArray['index_name']][0]) |
||
| 559 | && strlen($resArray['default_value']) > 0 |
||
| 560 | ) { |
||
| 561 | $metadata[$resArray['index_name']] = [$resArray['default_value']]; |
||
| 562 | } |
||
| 563 | // Set sorting value if applicable. |
||
| 564 | if ( |
||
| 565 | !empty($metadata[$resArray['index_name']]) |
||
| 566 | && $resArray['is_sortable'] |
||
| 567 | ) { |
||
| 568 | if ( |
||
| 569 | $resArray['format'] > 0 |
||
| 570 | && !empty($resArray['xpath_sorting']) |
||
| 571 | && ($values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode)) |
||
| 572 | ) { |
||
| 573 | if ( |
||
| 574 | $values instanceof \DOMNodeList |
||
| 575 | && $values->length > 0 |
||
| 576 | ) { |
||
| 577 | $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
||
| 578 | } elseif (!($values instanceof \DOMNodeList)) { |
||
| 579 | $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
||
| 580 | } |
||
| 581 | } |
||
| 582 | if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
||
| 583 | $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
||
| 584 | } |
||
| 585 | } |
||
| 586 | } |
||
| 587 | // Set title to empty string if not present. |
||
| 588 | if (empty($metadata['title'][0])) { |
||
| 589 | $metadata['title'][0] = ''; |
||
| 590 | $metadata['title_sorting'][0] = ''; |
||
| 591 | } |
||
| 592 | // Add collections and owner from database to toplevel element if document is already saved. |
||
| 593 | if ( |
||
| 594 | \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->uid) |
||
| 595 | && $id == $this->_getToplevelId() |
||
| 596 | ) { |
||
| 597 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 598 | ->getQueryBuilderForTable('tx_dlf_documents'); |
||
| 599 | |||
| 600 | $result = $queryBuilder |
||
| 601 | ->select( |
||
| 602 | 'tx_dlf_collections_join.index_name AS index_name' |
||
| 603 | ) |
||
| 604 | ->from('tx_dlf_documents') |
||
| 605 | ->innerJoin( |
||
| 606 | 'tx_dlf_documents', |
||
| 607 | 'tx_dlf_relations', |
||
| 608 | 'tx_dlf_relations_joins', |
||
| 609 | $queryBuilder->expr()->eq( |
||
| 610 | 'tx_dlf_relations_joins.uid_local', |
||
| 611 | 'tx_dlf_documents.uid' |
||
| 612 | ) |
||
| 613 | ) |
||
| 614 | ->innerJoin( |
||
| 615 | 'tx_dlf_relations_joins', |
||
| 616 | 'tx_dlf_collections', |
||
| 617 | 'tx_dlf_collections_join', |
||
| 618 | $queryBuilder->expr()->eq( |
||
| 619 | 'tx_dlf_relations_joins.uid_foreign', |
||
| 620 | 'tx_dlf_collections_join.uid' |
||
| 621 | ) |
||
| 622 | ) |
||
| 623 | ->where( |
||
| 624 | $queryBuilder->expr()->eq('tx_dlf_documents.pid', intval($cPid)), |
||
| 625 | $queryBuilder->expr()->eq('tx_dlf_documents.uid', intval($this->uid)) |
||
| 626 | ) |
||
| 627 | ->orderBy('tx_dlf_collections_join.index_name', 'ASC') |
||
| 628 | ->execute(); |
||
| 629 | |||
| 630 | $allResults = $result->fetchAll(); |
||
| 631 | |||
| 632 | foreach ($allResults as $resArray) { |
||
| 633 | if (!in_array($resArray['index_name'], $metadata['collection'])) { |
||
| 634 | $metadata['collection'][] = $resArray['index_name']; |
||
| 635 | } |
||
| 636 | } |
||
| 637 | |||
| 638 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 639 | ->getQueryBuilderForTable('tx_dlf_documents'); |
||
| 640 | |||
| 641 | $result = $queryBuilder |
||
| 642 | ->select( |
||
| 643 | 'tx_dlf_documents.owner AS owner' |
||
| 644 | ) |
||
| 645 | ->from('tx_dlf_documents') |
||
| 646 | ->where( |
||
| 647 | $queryBuilder->expr()->eq('tx_dlf_documents.pid', intval($cPid)), |
||
| 648 | $queryBuilder->expr()->eq('tx_dlf_documents.uid', intval($this->uid)) |
||
| 649 | ) |
||
| 650 | ->execute(); |
||
| 651 | |||
| 652 | $resArray = $result->fetch(); |
||
| 653 | |||
| 654 | $metadata['owner'][0] = $resArray['owner']; |
||
| 655 | } |
||
| 656 | // Extract metadata only from first supported dmdSec. |
||
| 657 | $hasSupportedMetadata = true; |
||
| 658 | break; |
||
| 659 | } |
||
| 660 | if ($hasSupportedMetadata) { |
||
| 661 | return $metadata; |
||
| 662 | } else { |
||
| 663 | $this->logger->warning('No supported metadata found for logical structure with @ID "' . $id . '"'); |
||
| 664 | return []; |
||
| 665 | } |
||
| 666 | } |
||
| 667 | |||
| 668 | /** |
||
| 669 | * {@inheritDoc} |
||
| 670 | * @see \Kitodo\Dlf\Common\Doc::getFullText() |
||
| 671 | */ |
||
| 672 | public function getFullText($id) |
||
| 673 | { |
||
| 674 | $fullText = ''; |
||
| 675 | |||
| 676 | // Load fileGrps and check for full text files. |
||
| 677 | $this->_getFileGrps(); |
||
| 678 | if ($this->hasFulltext) { |
||
| 679 | $fullText = $this->getFullTextFromXml($id); |
||
| 680 | } |
||
| 681 | return $fullText; |
||
| 682 | } |
||
| 683 | |||
| 684 | /** |
||
| 685 | * {@inheritDoc} |
||
| 686 | * @see Doc::getStructureDepth() |
||
| 687 | */ |
||
| 688 | public function getStructureDepth($logId) |
||
| 695 | } |
||
| 696 | } |
||
| 697 | |||
| 698 | /** |
||
| 699 | * {@inheritDoc} |
||
| 700 | * @see \Kitodo\Dlf\Common\Doc::init() |
||
| 701 | */ |
||
| 702 | protected function init() |
||
| 713 | } |
||
| 714 | } |
||
| 715 | |||
| 716 | /** |
||
| 717 | * {@inheritDoc} |
||
| 718 | * @see \Kitodo\Dlf\Common\Doc::loadLocation() |
||
| 719 | */ |
||
| 720 | protected function loadLocation($location) |
||
| 721 | { |
||
| 722 | $fileResource = GeneralUtility::getUrl($location); |
||
| 723 | if ($fileResource !== false) { |
||
| 724 | $xml = Helper::getXmlFileAsString($fileResource); |
||
| 725 | // Set some basic properties. |
||
| 726 | if ($xml !== false) { |
||
| 727 | $this->xml = $xml; |
||
| 728 | return true; |
||
| 729 | } |
||
| 730 | } |
||
| 731 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
||
| 732 | return false; |
||
| 733 | } |
||
| 734 | |||
| 735 | /** |
||
| 736 | * {@inheritDoc} |
||
| 737 | * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet() |
||
| 738 | */ |
||
| 739 | protected function ensureHasFulltextIsSet() |
||
| 740 | { |
||
| 741 | // Are the fileGrps already loaded? |
||
| 742 | if (!$this->fileGrpsLoaded) { |
||
| 743 | $this->_getFileGrps(); |
||
| 744 | } |
||
| 745 | } |
||
| 746 | |||
| 747 | /** |
||
| 748 | * {@inheritDoc} |
||
| 749 | * @see Doc::getParentDocumentUid() |
||
| 750 | */ |
||
| 751 | protected function getParentDocumentUidForSaving($pid, $core, $owner) |
||
| 752 | { |
||
| 753 | $partof = 0; |
||
| 754 | // Get the closest ancestor of the current document which has a MPTR child. |
||
| 755 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
||
| 756 | if (!empty($parentMptr)) { |
||
| 757 | $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
||
| 758 | if ($parentLocation != $this->location) { |
||
| 759 | $parentDoc = self::getInstance($parentLocation, $pid); |
||
| 760 | if ($parentDoc->ready) { |
||
| 761 | if ($parentDoc->pid != $pid) { |
||
| 762 | $parentDoc->save($pid, $core, $owner); |
||
| 763 | } |
||
| 764 | $partof = $parentDoc->uid; |
||
| 765 | } |
||
| 766 | } |
||
| 767 | } |
||
| 768 | return $partof; |
||
| 769 | } |
||
| 770 | |||
| 771 | /** |
||
| 772 | * {@inheritDoc} |
||
| 773 | * @see Doc::setPreloadedDocument() |
||
| 774 | */ |
||
| 775 | protected function setPreloadedDocument($preloadedDocument) |
||
| 776 | { |
||
| 777 | |||
| 778 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
||
| 779 | $this->xml = $preloadedDocument; |
||
| 780 | return true; |
||
| 781 | } |
||
| 782 | return false; |
||
| 783 | } |
||
| 784 | |||
| 785 | /** |
||
| 786 | * {@inheritDoc} |
||
| 787 | * @see Doc::getDocument() |
||
| 788 | */ |
||
| 789 | protected function getDocument() |
||
| 792 | } |
||
| 793 | |||
| 794 | /** |
||
| 795 | * This builds an array of the document's dmdSecs |
||
| 796 | * |
||
| 797 | * @access protected |
||
| 798 | * |
||
| 799 | * @return array Array of dmdSecs with their IDs as array key |
||
| 800 | */ |
||
| 801 | protected function _getDmdSec() |
||
| 802 | { |
||
| 803 | if (!$this->dmdSecLoaded) { |
||
| 804 | // Get available data formats. |
||
| 805 | $this->loadFormats(); |
||
| 806 | // Get dmdSec nodes from METS. |
||
| 807 | $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
||
| 808 | if (!empty($dmdIds)) { |
||
| 809 | foreach ($dmdIds as $dmdId) { |
||
| 810 | if ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
||
| 811 | if (!empty($this->formats[(string) $type[0]])) { |
||
| 812 | $type = (string) $type[0]; |
||
| 813 | $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
||
| 814 | } |
||
| 815 | } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
||
| 816 | if (!empty($this->formats[(string) $type[0]])) { |
||
| 817 | $type = (string) $type[0]; |
||
| 818 | $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
||
| 819 | } |
||
| 820 | } |
||
| 821 | if (!empty($xml)) { |
||
| 822 | $this->dmdSec[(string) $dmdId]['type'] = $type; |
||
| 823 | $this->dmdSec[(string) $dmdId]['xml'] = $xml[0]; |
||
| 824 | $this->registerNamespaces($this->dmdSec[(string) $dmdId]['xml']); |
||
| 825 | } |
||
| 826 | } |
||
| 827 | } |
||
| 828 | $this->dmdSecLoaded = true; |
||
| 829 | } |
||
| 830 | return $this->dmdSec; |
||
| 831 | } |
||
| 832 | |||
| 833 | /** |
||
| 834 | * This builds the file ID -> USE concordance |
||
| 835 | * |
||
| 836 | * @access protected |
||
| 837 | * |
||
| 838 | * @return array Array of file use groups with file IDs |
||
| 839 | */ |
||
| 840 | protected function _getFileGrps() |
||
| 880 | } |
||
| 881 | |||
| 882 | /** |
||
| 883 | * {@inheritDoc} |
||
| 884 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
||
| 885 | */ |
||
| 886 | protected function prepareMetadataArray($cPid) |
||
| 887 | { |
||
| 888 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
||
| 889 | // Get all logical structure nodes with metadata. |
||
| 890 | if (!empty($ids)) { |
||
| 891 | foreach ($ids as $id) { |
||
| 892 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
||
| 893 | } |
||
| 894 | } |
||
| 895 | // Set current PID for metadata definitions. |
||
| 896 | } |
||
| 897 | |||
| 898 | /** |
||
| 899 | * This returns $this->mets via __get() |
||
| 900 | * |
||
| 901 | * @access protected |
||
| 902 | * |
||
| 903 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
||
| 904 | */ |
||
| 905 | protected function _getMets() |
||
| 908 | } |
||
| 909 | |||
| 910 | /** |
||
| 911 | * {@inheritDoc} |
||
| 912 | * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure() |
||
| 913 | */ |
||
| 914 | protected function _getPhysicalStructure() |
||
| 969 | } |
||
| 970 | |||
| 971 | /** |
||
| 972 | * {@inheritDoc} |
||
| 973 | * @see \Kitodo\Dlf\Common\Doc::_getSmLinks() |
||
| 974 | */ |
||
| 975 | protected function _getSmLinks() |
||
| 988 | } |
||
| 989 | |||
| 990 | /** |
||
| 991 | * return @string |
||
| 992 | */ |
||
| 993 | public function getThumbnail() |
||
| 994 | { |
||
| 995 | // Load extension configuration. |
||
| 996 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
||
| 997 | if (empty($extConf['fileGrpThumbs'])) { |
||
| 998 | $this->logger->warning('No fileGrp for thumbnails specified'); |
||
| 999 | $this->thumbnailLoaded = true; |
||
| 1000 | return $this->thumbnail; |
||
| 1001 | } |
||
| 1002 | $strctId = $this->_getToplevelId(); |
||
| 1003 | $metadata = $this->getTitledata($cPid); |
||
| 1004 | |||
| 1005 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 1006 | ->getQueryBuilderForTable('tx_dlf_structures'); |
||
| 1007 | |||
| 1008 | // Get structure element to get thumbnail from. |
||
| 1009 | $result = $queryBuilder |
||
| 1010 | ->select('tx_dlf_structures.thumbnail AS thumbnail') |
||
| 1011 | ->from('tx_dlf_structures') |
||
| 1012 | ->where( |
||
| 1013 | $queryBuilder->expr()->eq('tx_dlf_structures.pid', intval($this->cPid)), |
||
| 1014 | $queryBuilder->expr()->eq('tx_dlf_structures.index_name', $queryBuilder->expr()->literal($metadata['type'][0])), |
||
| 1015 | Helper::whereExpression('tx_dlf_structures') |
||
| 1016 | ) |
||
| 1017 | ->setMaxResults(1) |
||
| 1018 | ->execute(); |
||
| 1019 | |||
| 1020 | $allResults = $result->fetchAll(); |
||
| 1021 | |||
| 1022 | if (count($allResults) == 1) { |
||
| 1023 | $resArray = $allResults[0]; |
||
| 1024 | // Get desired thumbnail structure if not the toplevel structure itself. |
||
| 1025 | if (!empty($resArray['thumbnail'])) { |
||
| 1026 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $this->cPid); |
||
| 1027 | // Check if this document has a structure element of the desired type. |
||
| 1028 | $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
||
| 1029 | if (!empty($strctIds)) { |
||
| 1030 | $strctId = (string) $strctIds[0]; |
||
| 1031 | } |
||
| 1032 | } |
||
| 1033 | // Load smLinks. |
||
| 1034 | $this->_getSmLinks(); |
||
| 1035 | // Get thumbnail location. |
||
| 1036 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
||
| 1037 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
||
| 1038 | if ( |
||
| 1039 | $this->_getPhysicalStructure() |
||
| 1040 | && !empty($this->smLinks['l2p'][$strctId]) |
||
| 1041 | && !empty($this->physicalStructureInfo[$this->smLinks['l2p'][$strctId][0]]['files'][$fileGrpThumb]) |
||
| 1042 | ) { |
||
| 1043 | $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->smLinks['l2p'][$strctId][0]]['files'][$fileGrpThumb]); |
||
| 1044 | break; |
||
| 1045 | } elseif (!empty($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb])) { |
||
| 1046 | $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb]); |
||
| 1047 | break; |
||
| 1048 | } |
||
| 1049 | } |
||
| 1050 | } else { |
||
| 1051 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
||
| 1052 | } |
||
| 1053 | return $this->thumbnail; |
||
| 1054 | } |
||
| 1055 | |||
| 1056 | /** |
||
| 1057 | * {@inheritDoc} |
||
| 1058 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
||
| 1059 | */ |
||
| 1060 | protected function _getThumbnail($forceReload = false) |
||
| 1061 | { |
||
| 1062 | if ( |
||
| 1063 | !$this->thumbnailLoaded |
||
| 1064 | || $forceReload |
||
| 1065 | ) { |
||
| 1066 | // Retain current PID. |
||
| 1067 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
||
| 1068 | if (!$cPid) { |
||
| 1069 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
||
| 1070 | $this->thumbnailLoaded = true; |
||
| 1071 | return $this->thumbnail; |
||
| 1072 | } |
||
| 1073 | // Load extension configuration. |
||
| 1074 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
||
| 1075 | if (empty($extConf['fileGrpThumbs'])) { |
||
| 1076 | $this->logger->warning('No fileGrp for thumbnails specified'); |
||
| 1077 | $this->thumbnailLoaded = true; |
||
| 1078 | return $this->thumbnail; |
||
| 1079 | } |
||
| 1080 | $strctId = $this->_getToplevelId(); |
||
| 1081 | $metadata = $this->getTitledata($cPid); |
||
| 1082 | |||
| 1083 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 1084 | ->getQueryBuilderForTable('tx_dlf_structures'); |
||
| 1085 | |||
| 1086 | // Get structure element to get thumbnail from. |
||
| 1087 | $result = $queryBuilder |
||
| 1088 | ->select('tx_dlf_structures.thumbnail AS thumbnail') |
||
| 1089 | ->from('tx_dlf_structures') |
||
| 1090 | ->where( |
||
| 1091 | $queryBuilder->expr()->eq('tx_dlf_structures.pid', intval($cPid)), |
||
| 1092 | $queryBuilder->expr()->eq('tx_dlf_structures.index_name', $queryBuilder->expr()->literal($metadata['type'][0])), |
||
| 1093 | Helper::whereExpression('tx_dlf_structures') |
||
| 1094 | ) |
||
| 1095 | ->setMaxResults(1) |
||
| 1096 | ->execute(); |
||
| 1097 | |||
| 1098 | $allResults = $result->fetchAll(); |
||
| 1099 | |||
| 1100 | if (count($allResults) == 1) { |
||
| 1101 | $resArray = $allResults[0]; |
||
| 1102 | // Get desired thumbnail structure if not the toplevel structure itself. |
||
| 1103 | if (!empty($resArray['thumbnail'])) { |
||
| 1104 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
||
| 1105 | // Check if this document has a structure element of the desired type. |
||
| 1106 | $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
||
| 1107 | if (!empty($strctIds)) { |
||
| 1108 | $strctId = (string) $strctIds[0]; |
||
| 1109 | } |
||
| 1110 | } |
||
| 1111 | // Load smLinks. |
||
| 1112 | $this->_getSmLinks(); |
||
| 1113 | // Get thumbnail location. |
||
| 1114 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
||
| 1115 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
||
| 1116 | if ( |
||
| 1117 | $this->_getPhysicalStructure() |
||
| 1118 | && !empty($this->smLinks['l2p'][$strctId]) |
||
| 1119 | && !empty($this->physicalStructureInfo[$this->smLinks['l2p'][$strctId][0]]['files'][$fileGrpThumb]) |
||
| 1120 | ) { |
||
| 1121 | $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->smLinks['l2p'][$strctId][0]]['files'][$fileGrpThumb]); |
||
| 1122 | break; |
||
| 1123 | } elseif (!empty($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb])) { |
||
| 1124 | $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb]); |
||
| 1125 | break; |
||
| 1126 | } |
||
| 1127 | } |
||
| 1128 | } else { |
||
| 1129 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
||
| 1130 | } |
||
| 1131 | $this->thumbnailLoaded = true; |
||
| 1132 | } |
||
| 1133 | return $this->thumbnail; |
||
| 1134 | } |
||
| 1135 | |||
| 1136 | /** |
||
| 1137 | * {@inheritDoc} |
||
| 1138 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
||
| 1139 | */ |
||
| 1140 | protected function _getToplevelId() |
||
| 1141 | { |
||
| 1142 | if (empty($this->toplevelId)) { |
||
| 1143 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
||
| 1144 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
||
| 1145 | if (!empty($divs)) { |
||
| 1146 | // Load smLinks. |
||
| 1147 | $this->_getSmLinks(); |
||
| 1148 | foreach ($divs as $div) { |
||
| 1149 | $id = (string) $div['ID']; |
||
| 1150 | // Are there physical structure nodes for this logical structure? |
||
| 1151 | if (array_key_exists($id, $this->smLinks['l2p'])) { |
||
| 1152 | // Yes. That's what we're looking for. |
||
| 1153 | $this->toplevelId = $id; |
||
| 1154 | break; |
||
| 1155 | } elseif (empty($this->toplevelId)) { |
||
| 1156 | // No. Remember this anyway, but keep looking for a better one. |
||
| 1157 | $this->toplevelId = $id; |
||
| 1158 | } |
||
| 1159 | } |
||
| 1160 | } |
||
| 1161 | } |
||
| 1162 | return $this->toplevelId; |
||
| 1163 | } |
||
| 1164 | |||
| 1165 | /** |
||
| 1166 | * This magic method is executed prior to any serialization of the object |
||
| 1167 | * @see __wakeup() |
||
| 1168 | * |
||
| 1169 | * @access public |
||
| 1170 | * |
||
| 1171 | * @return array Properties to be serialized |
||
| 1172 | */ |
||
| 1173 | public function __sleep() |
||
| 1178 | } |
||
| 1179 | |||
| 1180 | /** |
||
| 1181 | * This magic method is used for setting a string value for the object |
||
| 1182 | * |
||
| 1183 | * @access public |
||
| 1184 | * |
||
| 1185 | * @return string String representing the METS object |
||
| 1186 | */ |
||
| 1187 | public function __toString() |
||
| 1193 | } |
||
| 1194 | |||
| 1195 | /** |
||
| 1196 | * This magic method is executed after the object is deserialized |
||
| 1197 | * @see __sleep() |
||
| 1198 | * |
||
| 1199 | * @access public |
||
| 1200 | * |
||
| 1201 | * @return void |
||
| 1202 | */ |
||
| 1203 | public function __wakeup() |
||
| 1216 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.