We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 104 |
| Total Lines | 550 |
| Duplicated Lines | 0 % |
| Changes | 12 | ||
| Bugs | 0 | Features | 0 |
Complex classes like TableOfContentsController 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 TableOfContentsController, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 27 | class TableOfContentsController extends AbstractController |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * This holds the active entries according to the currently selected page |
||
| 31 | * |
||
| 32 | * @var array |
||
| 33 | * @access protected |
||
| 34 | */ |
||
| 35 | protected $activeEntries = []; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * This holds the list of authors for autocomplete |
||
| 39 | * |
||
| 40 | * @var array |
||
| 41 | * @access protected |
||
| 42 | */ |
||
| 43 | protected $authors = []; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * This holds the list of titles for autocomplete |
||
| 47 | * |
||
| 48 | * @var array |
||
| 49 | * @access protected |
||
| 50 | */ |
||
| 51 | protected $titles = []; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * The main method of the plugin |
||
| 55 | * |
||
| 56 | * @return void |
||
| 57 | */ |
||
| 58 | public function mainAction() |
||
| 59 | { |
||
| 60 | // Load current document. |
||
| 61 | $this->loadDocument($this->requestData); |
||
| 62 | if ( |
||
| 63 | $this->document === null |
||
| 64 | || $this->document->getDoc() === null |
||
| 65 | ) { |
||
| 66 | // Quit without doing anything if required variables are not set. |
||
| 67 | return; |
||
| 68 | } else { |
||
| 69 | if (!empty($this->requestData['logicalPage'])) { |
||
| 70 | $this->requestData['page'] = $this->document->getDoc()->getPhysicalPage($this->requestData['logicalPage']); |
||
| 71 | // The logical page parameter should not appear again |
||
| 72 | unset($this->requestData['logicalPage']); |
||
| 73 | } |
||
| 74 | if ($this->document->getDoc()->tableOfContents[0]['type'] == 'collection') { |
||
| 75 | $this->view->assign('currentList', $this->requestData['id']); |
||
| 76 | if (isset($this->requestData['transform'])) { |
||
| 77 | $this->view->assign('transform', $this->requestData['transform']); |
||
| 78 | } else { |
||
| 79 | $this->view->assign('transform', 'something'); |
||
| 80 | } |
||
| 81 | $this->view->assign('type', 'collection'); |
||
| 82 | $this->view->assign('types', $this->getTypes($this->document->getDoc()->tableOfContents)); |
||
| 83 | $this->view->assign('toc', $this->makeMenuFor3DObjects()); |
||
| 84 | $this->sortAuthors(); |
||
| 85 | $this->view->assign('authors', $this->authors); |
||
| 86 | natcasesort($this->titles); |
||
| 87 | $this->view->assign('titles', $this->titles); |
||
| 88 | $this->view->assign('softwares', $this->getSoftwares($this->document->getDoc()->tableOfContents)); |
||
| 89 | } else { |
||
| 90 | $this->view->assign('type', 'other'); |
||
| 91 | $this->view->assign('toc', $this->makeMenuArray()); |
||
| 92 | } |
||
| 93 | } |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * This builds a menu array for HMENU |
||
| 98 | * |
||
| 99 | * @access protected |
||
| 100 | * @return array HMENU array |
||
| 101 | */ |
||
| 102 | protected function makeMenuArray() |
||
| 103 | { |
||
| 104 | // Set default values for page if not set. |
||
| 105 | // $this->requestData['page'] may be integer or string (physical structure @ID) |
||
| 106 | if ( |
||
| 107 | (int) $this->requestData['page'] > 0 |
||
| 108 | || empty($this->requestData['page']) |
||
| 109 | ) { |
||
| 110 | $this->requestData['page'] = MathUtility::forceIntegerInRange((int) $this->requestData['page'], 1, $this->document->getDoc()->numPages, 1); |
||
| 111 | } else { |
||
| 112 | $this->requestData['page'] = array_search($this->requestData['page'], $this->document->getDoc()->physicalStructure); |
||
| 113 | } |
||
| 114 | $this->requestData['double'] = MathUtility::forceIntegerInRange($this->requestData['double'], 0, 1, 0); |
||
| 115 | $menuArray = []; |
||
| 116 | // Does the document have physical elements or is it an external file? |
||
| 117 | if ( |
||
| 118 | !empty($this->document->getDoc()->physicalStructure) |
||
| 119 | || !MathUtility::canBeInterpretedAsInteger($this->requestData['id']) |
||
| 120 | ) { |
||
| 121 | // Get all logical units the current page or track is a part of. |
||
| 122 | if ( |
||
| 123 | !empty($this->requestData['page']) |
||
| 124 | && !empty($this->document->getDoc()->physicalStructure) |
||
| 125 | ) { |
||
| 126 | $this->activeEntries = array_merge((array) $this->document->getDoc()->smLinks['p2l'][$this->document->getDoc()->physicalStructure[0]], |
||
| 127 | (array) $this->document->getDoc()->smLinks['p2l'][$this->document->getDoc()->physicalStructure[$this->requestData['page']]]); |
||
| 128 | if ( |
||
| 129 | !empty($this->requestData['double']) |
||
| 130 | && $this->requestData['page'] < $this->document->getDoc()->numPages |
||
| 131 | ) { |
||
| 132 | $this->activeEntries = array_merge($this->activeEntries, |
||
| 133 | (array) $this->document->getDoc()->smLinks['p2l'][$this->document->getDoc()->physicalStructure[$this->requestData['page'] + 1]]); |
||
| 134 | } |
||
| 135 | } |
||
| 136 | // Go through table of contents and create all menu entries. |
||
| 137 | foreach ($this->document->getDoc()->tableOfContents as $entry) { |
||
| 138 | $menuArray[] = $this->getMenuEntry($entry, true); |
||
| 139 | } |
||
| 140 | } else { |
||
| 141 | // Go through table of contents and create top-level menu entries. |
||
| 142 | foreach ($this->document->getDoc()->tableOfContents as $entry) { |
||
| 143 | $menuArray[] = $this->getMenuEntry($entry, false); |
||
| 144 | } |
||
| 145 | // Build table of contents from database. |
||
| 146 | $result = $this->documentRepository->getTableOfContentsFromDb($this->document->getUid(), $this->document->getPid(), $this->settings); |
||
| 147 | |||
| 148 | $allResults = $result->fetchAll(); |
||
|
|
|||
| 149 | |||
| 150 | if (count($allResults) > 0) { |
||
| 151 | $menuArray[0]['ITEM_STATE'] = 'CURIFSUB'; |
||
| 152 | $menuArray[0]['_SUB_MENU'] = []; |
||
| 153 | foreach ($allResults as $resArray) { |
||
| 154 | $entry = [ |
||
| 155 | 'label' => !empty($resArray['mets_label']) ? $resArray['mets_label'] : $resArray['title'], |
||
| 156 | 'type' => $resArray['type'], |
||
| 157 | 'volume' => $resArray['volume'], |
||
| 158 | 'orderlabel' => $resArray['mets_orderlabel'], |
||
| 159 | 'pagination' => '', |
||
| 160 | 'targetUid' => $resArray['uid'] |
||
| 161 | ]; |
||
| 162 | $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, false); |
||
| 163 | } |
||
| 164 | } |
||
| 165 | } |
||
| 166 | return $menuArray; |
||
| 167 | } |
||
| 168 | |||
| 169 | /** |
||
| 170 | * This builds a menu for list of 3D objects |
||
| 171 | * |
||
| 172 | * @access protected |
||
| 173 | * |
||
| 174 | * @param string $content: The PlugIn content |
||
| 175 | * @param array $conf: The PlugIn configuration |
||
| 176 | * |
||
| 177 | * @return array HMENU array |
||
| 178 | */ |
||
| 179 | protected function makeMenuFor3DObjects() |
||
| 180 | { |
||
| 181 | $menuArray = []; |
||
| 182 | // Is the document an external file? |
||
| 183 | if (!MathUtility::canBeInterpretedAsInteger($this->requestData['id'])) { |
||
| 184 | // Go through table of contents and create all menu entries. |
||
| 185 | foreach ($this->document->getDoc()->tableOfContents as $entry) { |
||
| 186 | $menuArray[] = $this->getMenuEntryWithImage($entry, true); |
||
| 187 | } |
||
| 188 | } |
||
| 189 | return $menuArray; |
||
| 190 | } |
||
| 191 | |||
| 192 | /** |
||
| 193 | * This builds an array for one menu entry |
||
| 194 | * |
||
| 195 | * @access protected |
||
| 196 | * |
||
| 197 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 198 | * @param bool $recursive : Whether to include the child entries |
||
| 199 | * |
||
| 200 | * @return array HMENU array for menu entry |
||
| 201 | */ |
||
| 202 | protected function getMenuEntry(array $entry, $recursive = false) |
||
| 203 | { |
||
| 204 | $entry = $this->resolveMenuEntry($entry); |
||
| 205 | |||
| 206 | $entryArray = []; |
||
| 207 | // Set "title", "volume", "type" and "pagination" from $entry array. |
||
| 208 | $entryArray['title'] = !empty($entry['label']) ? $entry['label'] : $entry['orderlabel']; |
||
| 209 | $entryArray['volume'] = $entry['volume']; |
||
| 210 | $entryArray['orderlabel'] = $entry['orderlabel']; |
||
| 211 | $entryArray['type'] = Helper::translate($entry['type'], 'tx_dlf_structures', $this->settings['storagePid']); |
||
| 212 | $entryArray['pagination'] = htmlspecialchars($entry['pagination']); |
||
| 213 | $entryArray['_OVERRIDE_HREF'] = ''; |
||
| 214 | $entryArray['doNotLinkIt'] = 1; |
||
| 215 | $entryArray['ITEM_STATE'] = 'NO'; |
||
| 216 | // Build menu links based on the $entry['points'] array. |
||
| 217 | if ( |
||
| 218 | !empty($entry['points']) |
||
| 219 | && MathUtility::canBeInterpretedAsInteger($entry['points']) |
||
| 220 | ) { |
||
| 221 | $entryArray['page'] = $entry['points']; |
||
| 222 | |||
| 223 | $entryArray['doNotLinkIt'] = 0; |
||
| 224 | if ($this->settings['basketButton']) { |
||
| 225 | $entryArray['basketButton'] = [ |
||
| 226 | 'logId' => $entry['id'], |
||
| 227 | 'startpage' => $entry['points'] |
||
| 228 | ]; |
||
| 229 | } |
||
| 230 | } elseif ( |
||
| 231 | !empty($entry['points']) |
||
| 232 | && is_string($entry['points']) |
||
| 233 | ) { |
||
| 234 | $entryArray['id'] = $entry['points']; |
||
| 235 | $entryArray['page'] = 1; |
||
| 236 | $entryArray['doNotLinkIt'] = 0; |
||
| 237 | if ($this->settings['basketButton']) { |
||
| 238 | $entryArray['basketButton'] = [ |
||
| 239 | 'logId' => $entry['id'], |
||
| 240 | 'startpage' => $entry['points'] |
||
| 241 | ]; |
||
| 242 | } |
||
| 243 | } elseif (!empty($entry['targetUid'])) { |
||
| 244 | $entryArray['id'] = $entry['targetUid']; |
||
| 245 | $entryArray['page'] = 1; |
||
| 246 | $entryArray['doNotLinkIt'] = 0; |
||
| 247 | if ($this->settings['basketButton']) { |
||
| 248 | $entryArray['basketButton'] = [ |
||
| 249 | 'logId' => $entry['id'], |
||
| 250 | 'startpage' => $entry['targetUid'] |
||
| 251 | ]; |
||
| 252 | } |
||
| 253 | } |
||
| 254 | // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
||
| 255 | if (in_array($entry['id'], $this->activeEntries)) { |
||
| 256 | $entryArray['ITEM_STATE'] = 'CUR'; |
||
| 257 | } |
||
| 258 | // Build sub-menu if available and called recursively. |
||
| 259 | if ( |
||
| 260 | $recursive === true |
||
| 261 | && !empty($entry['children']) |
||
| 262 | ) { |
||
| 263 | // Build sub-menu only if one of the following conditions apply: |
||
| 264 | // 1. Current menu node is in rootline |
||
| 265 | // 2. Current menu node points to another file |
||
| 266 | // 3. Current menu node has no corresponding images |
||
| 267 | if ( |
||
| 268 | $entryArray['ITEM_STATE'] == 'CUR' |
||
| 269 | || is_string($entry['points']) |
||
| 270 | || empty($this->document->getDoc()->smLinks['l2p'][$entry['id']]) |
||
| 271 | ) { |
||
| 272 | $entryArray['_SUB_MENU'] = []; |
||
| 273 | foreach ($entry['children'] as $child) { |
||
| 274 | // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
||
| 275 | if (in_array($child['id'], $this->activeEntries)) { |
||
| 276 | $entryArray['ITEM_STATE'] = 'ACT'; |
||
| 277 | } |
||
| 278 | $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, true); |
||
| 279 | } |
||
| 280 | } |
||
| 281 | // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
||
| 282 | $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'] . 'IFSUB'); |
||
| 283 | } |
||
| 284 | return $entryArray; |
||
| 285 | } |
||
| 286 | |||
| 287 | /** |
||
| 288 | * If $entry references an external METS file (as mptr), |
||
| 289 | * try to resolve its database UID and return an updated $entry. |
||
| 290 | * |
||
| 291 | * This is so that when linking from a child document back to its parent, |
||
| 292 | * that link is via UID, so that subsequently the parent's TOC is built from database. |
||
| 293 | * |
||
| 294 | * @param array $entry |
||
| 295 | * @return array |
||
| 296 | */ |
||
| 297 | protected function resolveMenuEntry($entry) |
||
| 298 | { |
||
| 299 | // If the menu entry points to the parent document, |
||
| 300 | // resolve to the parent UID set on indexation. |
||
| 301 | $doc = $this->document->getDoc(); |
||
| 302 | if ( |
||
| 303 | $doc instanceof MetsDocument |
||
| 304 | && $entry['points'] === $doc->parentHref |
||
| 305 | && !empty($this->document->getPartof()) |
||
| 306 | ) { |
||
| 307 | unset($entry['points']); |
||
| 308 | $entry['targetUid'] = $this->document->getPartof(); |
||
| 309 | } |
||
| 310 | |||
| 311 | return $entry; |
||
| 312 | } |
||
| 313 | |||
| 314 | /** |
||
| 315 | * This builds an array for one 3D menu entry |
||
| 316 | * |
||
| 317 | * @access protected |
||
| 318 | * |
||
| 319 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 320 | * @param bool $recursive : Whether to include the child entries |
||
| 321 | * |
||
| 322 | * @return array HMENU array for 3D menu entry |
||
| 323 | */ |
||
| 324 | protected function getMenuEntryWithImage(array $entry, $recursive = false) |
||
| 325 | { |
||
| 326 | $entryArray = []; |
||
| 327 | |||
| 328 | // don't filter if the entry type is collection |
||
| 329 | if ($entry['type'] != 'collection') { |
||
| 330 | if (!$this->isFound($entry)) { |
||
| 331 | return $entryArray; |
||
| 332 | } |
||
| 333 | } |
||
| 334 | |||
| 335 | // Set "title", "volume", "type" and "pagination" from $entry array. |
||
| 336 | $entryArray['title'] = !empty($entry['label']) ? $entry['label'] : $entry['orderlabel']; |
||
| 337 | $entryArray['orderlabel'] = $entry['orderlabel']; |
||
| 338 | $entryArray['type'] = Helper::translate($entry['type'], 'tx_dlf_structures', $this->settings['storagePid']); |
||
| 339 | $entryArray['pagination'] = htmlspecialchars($entry['pagination']); |
||
| 340 | $entryArray['doNotLinkIt'] = 1; |
||
| 341 | $entryArray['ITEM_STATE'] = 'HEADER'; |
||
| 342 | |||
| 343 | if ($entry['children'] == NULL) { |
||
| 344 | $entryArray['description'] = $entry['description']; |
||
| 345 | $entryArray['identifier'] = $entry['identifier']; |
||
| 346 | $id = str_replace("LOG", "PHYS", $entry['id']); |
||
| 347 | $entryArray['image'] = $this->document->getDoc()->getFileLocation($this->document->getDoc()->physicalStructureInfo[$id]['files']['THUMBS']); |
||
| 348 | $entryArray['doNotLinkIt'] = 0; |
||
| 349 | // index.php?tx_dlf%5Bid%5D=http%3A%2F%2Flink_to_METS_file.xml |
||
| 350 | $entryArray['urlId'] = GeneralUtility::_GET('id'); |
||
| 351 | $entryArray['urlXml'] = $entry['points']; |
||
| 352 | $entryArray['ITEM_STATE'] = 'ITEM'; |
||
| 353 | |||
| 354 | $this->addAuthorToAutocomplete($entryArray['author']); |
||
| 355 | $this->addTitleToAutocomplete($entryArray['title']); |
||
| 356 | } |
||
| 357 | |||
| 358 | // Build sub-menu if available and called recursively. |
||
| 359 | if ( |
||
| 360 | $recursive == true |
||
| 361 | && !empty($entry['children']) |
||
| 362 | ) { |
||
| 363 | // Build sub-menu only if one of the following conditions apply: |
||
| 364 | // 1. Current menu node points to another file |
||
| 365 | // 2. Current menu node has no corresponding images |
||
| 366 | if ( |
||
| 367 | is_string($entry['points']) |
||
| 368 | || empty($this->document->getDoc()->smLinks['l2p'][$entry['id']]) |
||
| 369 | ) { |
||
| 370 | $entryArray['_SUB_MENU'] = []; |
||
| 371 | foreach ($entry['children'] as $child) { |
||
| 372 | $menuEntry = $this->getMenuEntryWithImage($child); |
||
| 373 | if (!empty($menuEntry)) { |
||
| 374 | $entryArray['_SUB_MENU'][] = $menuEntry; |
||
| 375 | } |
||
| 376 | } |
||
| 377 | } |
||
| 378 | } |
||
| 379 | return $entryArray; |
||
| 380 | } |
||
| 381 | |||
| 382 | /** |
||
| 383 | * Check or possible combinations of requested params. |
||
| 384 | * |
||
| 385 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 386 | * |
||
| 387 | * @return bool true if found, false otherwise |
||
| 388 | */ |
||
| 389 | private function isFound($entry) { |
||
| 390 | if (!empty($this->requestData['title'] && !empty($this->requestData['type']) && !empty($this->requestData['author']))) { |
||
| 391 | return $this->isTitleFound($entry) && $this->isTypeFound($entry) && $this->isAuthorFound($entry); |
||
| 392 | } else if (!empty($this->requestData['title']) && !empty($this->requestData['author'])) { |
||
| 393 | return $this->isTitleFound($entry) && $this->isAuthorFound($entry); |
||
| 394 | } else if (!empty($this->requestData['title']) && !empty($this->requestData['type'])) { |
||
| 395 | return $this->isTitleFound($entry) && $this->isTypeFound($entry); |
||
| 396 | } else if (!empty($this->requestData['author']) && !empty($this->requestData['type'])) { |
||
| 397 | return $this->isAuthorFound($entry) && $this->isTypeFound($entry); |
||
| 398 | } else if (!empty($this->requestData['title'])) { |
||
| 399 | return $this->isTitleFound($entry); |
||
| 400 | } else if (!empty($this->requestData['author'])) { |
||
| 401 | return $this->isTypeFound($entry); |
||
| 402 | } else if (!empty($this->requestData['licence'])) { |
||
| 403 | return $this->isLicenceFound($entry); |
||
| 404 | } else if (!empty($this->requestData['type'])) { |
||
| 405 | return $this->isTypeFound($entry); |
||
| 406 | } else if (!empty($this->requestData['type'])) { |
||
| 407 | return $this->isSoftwareFound($entry); |
||
| 408 | } else { |
||
| 409 | // no parameters so entry is matching |
||
| 410 | return true; |
||
| 411 | } |
||
| 412 | } |
||
| 413 | |||
| 414 | /** |
||
| 415 | * Check if author is found. |
||
| 416 | * |
||
| 417 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 418 | * |
||
| 419 | * @return bool true if found, false otherwise |
||
| 420 | */ |
||
| 421 | private function isAuthorFound($entry) { |
||
| 422 | $value = strtolower($entry['author']); |
||
| 423 | $author = strtolower($this->requestData['author']); |
||
| 424 | return str_contains($value, $author); |
||
| 425 | } |
||
| 426 | |||
| 427 | /** |
||
| 428 | * Check if title is found. |
||
| 429 | * |
||
| 430 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 431 | * |
||
| 432 | * @return bool true if found, false otherwise |
||
| 433 | */ |
||
| 434 | private function isTitleFound($entry) { |
||
| 435 | $value = strtolower($entry['label']); |
||
| 436 | $title = strtolower($this->requestData['title']); |
||
| 437 | return str_contains($value, $title); |
||
| 438 | } |
||
| 439 | |||
| 440 | /** |
||
| 441 | * Check if type is found. |
||
| 442 | * |
||
| 443 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 444 | * |
||
| 445 | * @return bool true if found, false otherwise |
||
| 446 | */ |
||
| 447 | private function isTypeFound($entry) { |
||
| 448 | return str_contains($entry['identifier'], $this->requestData['types']); |
||
| 449 | } |
||
| 450 | |||
| 451 | /** |
||
| 452 | * Add author to the authors autocomplete array. |
||
| 453 | * |
||
| 454 | * @param string $author : author to be inserted to the authors autocomplete array |
||
| 455 | * |
||
| 456 | * @return void |
||
| 457 | */ |
||
| 458 | private function addAuthorToAutocomplete($author) { |
||
| 470 | } |
||
| 471 | } |
||
| 472 | } |
||
| 473 | |||
| 474 | /** |
||
| 475 | * Sort authors by surname - second part of the string |
||
| 476 | * |
||
| 477 | * @return void |
||
| 478 | */ |
||
| 479 | private function sortAuthors() { |
||
| 480 | usort($this->authors, function($firstAuthor, $secondAuthor) { |
||
| 481 | $firstAuthor = substr(strrchr($firstAuthor, ' '), 1); |
||
| 482 | $secondAuthor = substr(strrchr($secondAuthor, ' '), 1); |
||
| 483 | return strcmp($firstAuthor, $secondAuthor); |
||
| 484 | }); |
||
| 485 | } |
||
| 486 | |||
| 487 | /** |
||
| 488 | * Add title to the titles autocomplete array. |
||
| 489 | * |
||
| 490 | * @param string $title : title to be inserted to the titles autocomplete array |
||
| 491 | * |
||
| 492 | * @return void |
||
| 493 | */ |
||
| 494 | private function addTitleToAutocomplete($title) { |
||
| 495 | if (!(in_array($title, $this->titles)) && $title != NULL) { |
||
| 496 | $this->titles[] = $title; |
||
| 497 | } |
||
| 498 | } |
||
| 499 | |||
| 500 | /** |
||
| 501 | * Get all types. |
||
| 502 | * |
||
| 503 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 504 | * |
||
| 505 | * @return array of object types |
||
| 506 | */ |
||
| 507 | private function getTypes($entry) { |
||
| 508 | $types = []; |
||
| 509 | $index = 0; |
||
| 510 | |||
| 511 | if (!empty($entry[0]['children'])) { |
||
| 512 | foreach ($entry[0]['children'] as $child) { |
||
| 513 | $type = $this->getType($child); |
||
| 514 | if (!(in_array($type, $types)) && $type != NULL) { |
||
| 515 | $types[$index] = $type; |
||
| 516 | $index++; |
||
| 517 | } |
||
| 518 | } |
||
| 519 | } |
||
| 520 | natcasesort($types); |
||
| 521 | return $types; |
||
| 522 | } |
||
| 523 | |||
| 524 | /** |
||
| 525 | * Get single type for given entry. |
||
| 526 | * |
||
| 527 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 528 | * |
||
| 529 | * @return string type name without number |
||
| 530 | */ |
||
| 531 | private function getType($entry) { |
||
| 538 | } |
||
| 539 | |||
| 540 | /** |
||
| 541 | * Get all softwares. |
||
| 542 | * |
||
| 543 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 544 | * |
||
| 545 | * @return array of object softwares |
||
| 546 | */ |
||
| 547 | private function getSoftwares($entry) { |
||
| 562 | } |
||
| 563 | |||
| 564 | /** |
||
| 565 | * Get single software for given entry. |
||
| 566 | * |
||
| 567 | * @param array $entry : The entry's array from \Kitodo\Dlf\Common\Doc->getLogicalStructure |
||
| 568 | * |
||
| 569 | * @return string software name split by commas |
||
| 570 | */ |
||
| 571 | private function getSoftware($entry) { |
||
| 577 | } |
||
| 578 | } |
||
| 579 |
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.