@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Alto implements \Kitodo\Dlf\Common\FulltextInterface |
|
| 24 | -{ |
|
| 23 | +class Alto implements \Kitodo\Dlf\Common\FulltextInterface { |
|
| 25 | 24 | /** |
| 26 | 25 | * This extracts the fulltext data from ALTO XML |
| 27 | 26 | * |
@@ -31,8 +30,7 @@ discard block |
||
| 31 | 30 | * |
| 32 | 31 | * @return string The raw unformatted fulltext |
| 33 | 32 | */ |
| 34 | - public function getRawText(\SimpleXMLElement $xml) |
|
| 35 | - { |
|
| 33 | + public function getRawText(\SimpleXMLElement $xml) { |
|
| 36 | 34 | $rawText = ''; |
| 37 | 35 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
| 38 | 36 | // Get all (presumed) words of the text. |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class TeiHeader implements \Kitodo\Dlf\Common\MetadataInterface |
|
| 24 | -{ |
|
| 23 | +class TeiHeader implements \Kitodo\Dlf\Common\MetadataInterface { |
|
| 25 | 24 | /** |
| 26 | 25 | * This extracts the essential TEIHDR metadata from XML |
| 27 | 26 | * |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | * |
| 33 | 32 | * @return void |
| 34 | 33 | */ |
| 35 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
| 36 | - { |
|
| 34 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
| 37 | 35 | $xml->registerXPathNamespace('teihdr', 'http://www.tei-c.org/ns/1.0'); |
| 38 | 36 | } |
| 39 | 37 | } |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | } |
| 83 | 83 | // Append "valueURI" to name using Unicode unit separator. |
| 84 | 84 | if (isset($authors[$i]['valueURI'])) { |
| 85 | - $metadata['author'][$i] .= chr(31) . (string) $authors[$i]['valueURI']; |
|
| 85 | + $metadata['author'][$i] .= chr(31).(string) $authors[$i]['valueURI']; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Mods implements \Kitodo\Dlf\Common\MetadataInterface |
|
| 24 | -{ |
|
| 23 | +class Mods implements \Kitodo\Dlf\Common\MetadataInterface { |
|
| 25 | 24 | /** |
| 26 | 25 | * This extracts the essential MODS metadata from XML |
| 27 | 26 | * |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | * |
| 33 | 32 | * @return void |
| 34 | 33 | */ |
| 35 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
| 36 | - { |
|
| 34 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
| 37 | 35 | $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
| 38 | 36 | // Get "author" and "author_sorting". |
| 39 | 37 | $authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]'); |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | * @access public |
| 22 | 22 | * @abstract |
| 23 | 23 | */ |
| 24 | -interface FulltextInterface |
|
| 25 | -{ |
|
| 24 | +interface FulltextInterface { |
|
| 26 | 25 | /** |
| 27 | 26 | * This extracts raw fulltext data from XML |
| 28 | 27 | * |
@@ -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 | * |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class IiifUrlReader implements UrlReaderInterface |
|
| 29 | -{ |
|
| 28 | +class IiifUrlReader implements UrlReaderInterface { |
|
| 30 | 29 | /** |
| 31 | 30 | * Singleton instance of the class |
| 32 | 31 | * |
@@ -40,8 +39,7 @@ discard block |
||
| 40 | 39 | * {@inheritDoc} |
| 41 | 40 | * @see \Ubl\Iiif\Tools\UrlReaderInterface::getContent() |
| 42 | 41 | */ |
| 43 | - public function getContent($url) |
|
| 44 | - { |
|
| 42 | + public function getContent($url) { |
|
| 45 | 43 | $fileContents = GeneralUtility::getUrl($url); |
| 46 | 44 | if ($fileContents !== false) { |
| 47 | 45 | return $fileContents; |
@@ -57,8 +55,7 @@ discard block |
||
| 57 | 55 | * |
| 58 | 56 | * @return IiifUrlReader |
| 59 | 57 | */ |
| 60 | - public static function getInstance() |
|
| 61 | - { |
|
| 58 | + public static function getInstance() { |
|
| 62 | 59 | if (!isset(self::$instance)) { |
| 63 | 60 | self::$instance = new IiifUrlReader(); |
| 64 | 61 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function getContent($url) |
| 44 | 44 | { |
| 45 | 45 | $fileContents = GeneralUtility::getUrl($url); |
| 46 | - if ($fileContents !== false) { |
|
| 46 | + if ($fileContents !== FALSE) { |
|
| 47 | 47 | return $fileContents; |
| 48 | 48 | } else { |
| 49 | 49 | return ''; |
@@ -97,8 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - public function add(array $elements, $position = -1) |
|
| 101 | - { |
|
| 100 | + public function add(array $elements, $position = -1) { |
|
| 102 | 101 | $position = MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count); |
| 103 | 102 | if (!empty($elements)) { |
| 104 | 103 | array_splice($this->elements, $position, 0, $elements); |
@@ -114,8 +113,7 @@ discard block |
||
| 114 | 113 | * |
| 115 | 114 | * @return int The number of elements in the list |
| 116 | 115 | */ |
| 117 | - public function count() |
|
| 118 | - { |
|
| 116 | + public function count() { |
|
| 119 | 117 | return $this->count; |
| 120 | 118 | } |
| 121 | 119 | |
@@ -127,8 +125,7 @@ discard block |
||
| 127 | 125 | * |
| 128 | 126 | * @return array The current element |
| 129 | 127 | */ |
| 130 | - public function current() |
|
| 131 | - { |
|
| 128 | + public function current() { |
|
| 132 | 129 | if ($this->valid()) { |
| 133 | 130 | return $this->getRecord($this->elements[$this->position]); |
| 134 | 131 | } else { |
@@ -146,8 +143,7 @@ discard block |
||
| 146 | 143 | * |
| 147 | 144 | * @return mixed The element's full record |
| 148 | 145 | */ |
| 149 | - protected function getRecord($element) |
|
| 150 | - { |
|
| 146 | + protected function getRecord($element) { |
|
| 151 | 147 | if ( |
| 152 | 148 | is_array($element) |
| 153 | 149 | && array_keys($element) == ['u', 'h', 's', 'p'] |
@@ -318,8 +314,7 @@ discard block |
||
| 318 | 314 | * |
| 319 | 315 | * @return int The current position |
| 320 | 316 | */ |
| 321 | - public function key() |
|
| 322 | - { |
|
| 317 | + public function key() { |
|
| 323 | 318 | return $this->position; |
| 324 | 319 | } |
| 325 | 320 | |
@@ -333,8 +328,7 @@ discard block |
||
| 333 | 328 | * |
| 334 | 329 | * @return void |
| 335 | 330 | */ |
| 336 | - public function move($position, $steps) |
|
| 337 | - { |
|
| 331 | + public function move($position, $steps) { |
|
| 338 | 332 | $position = intval($position); |
| 339 | 333 | // Check if list position is valid. |
| 340 | 334 | if ( |
@@ -365,8 +359,7 @@ discard block |
||
| 365 | 359 | * |
| 366 | 360 | * @return void |
| 367 | 361 | */ |
| 368 | - public function moveUp($position) |
|
| 369 | - { |
|
| 362 | + public function moveUp($position) { |
|
| 370 | 363 | $this->move($position, -1); |
| 371 | 364 | } |
| 372 | 365 | |
@@ -379,8 +372,7 @@ discard block |
||
| 379 | 372 | * |
| 380 | 373 | * @return void |
| 381 | 374 | */ |
| 382 | - public function moveDown($position) |
|
| 383 | - { |
|
| 375 | + public function moveDown($position) { |
|
| 384 | 376 | $this->move($position, 1); |
| 385 | 377 | } |
| 386 | 378 | |
@@ -392,8 +384,7 @@ discard block |
||
| 392 | 384 | * |
| 393 | 385 | * @return void |
| 394 | 386 | */ |
| 395 | - public function next() |
|
| 396 | - { |
|
| 387 | + public function next() { |
|
| 397 | 388 | $this->position++; |
| 398 | 389 | } |
| 399 | 390 | |
@@ -407,8 +398,7 @@ discard block |
||
| 407 | 398 | * |
| 408 | 399 | * @return bool Does the given offset exist? |
| 409 | 400 | */ |
| 410 | - public function offsetExists($offset) |
|
| 411 | - { |
|
| 401 | + public function offsetExists($offset) { |
|
| 412 | 402 | return isset($this->elements[$offset]); |
| 413 | 403 | } |
| 414 | 404 | |
@@ -422,8 +412,7 @@ discard block |
||
| 422 | 412 | * |
| 423 | 413 | * @return array The element at the given offset |
| 424 | 414 | */ |
| 425 | - public function offsetGet($offset) |
|
| 426 | - { |
|
| 415 | + public function offsetGet($offset) { |
|
| 427 | 416 | if ($this->offsetExists($offset)) { |
| 428 | 417 | return $this->getRecord($this->elements[$offset]); |
| 429 | 418 | } else { |
@@ -443,8 +432,7 @@ discard block |
||
| 443 | 432 | * |
| 444 | 433 | * @return void |
| 445 | 434 | */ |
| 446 | - public function offsetSet($offset, $value) |
|
| 447 | - { |
|
| 435 | + public function offsetSet($offset, $value) { |
|
| 448 | 436 | if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) { |
| 449 | 437 | $this->elements[$offset] = $value; |
| 450 | 438 | } else { |
@@ -464,8 +452,7 @@ discard block |
||
| 464 | 452 | * |
| 465 | 453 | * @return array The removed element |
| 466 | 454 | */ |
| 467 | - public function remove($position) |
|
| 468 | - { |
|
| 455 | + public function remove($position) { |
|
| 469 | 456 | $position = intval($position); |
| 470 | 457 | if ( |
| 471 | 458 | $position < 0 |
@@ -489,8 +476,7 @@ discard block |
||
| 489 | 476 | * |
| 490 | 477 | * @return array The indizes of the removed elements |
| 491 | 478 | */ |
| 492 | - public function removeRange($position, $length) |
|
| 493 | - { |
|
| 479 | + public function removeRange($position, $length) { |
|
| 494 | 480 | $position = intval($position); |
| 495 | 481 | if ( |
| 496 | 482 | $position < 0 |
@@ -511,8 +497,7 @@ discard block |
||
| 511 | 497 | * |
| 512 | 498 | * @return void |
| 513 | 499 | */ |
| 514 | - public function reset() |
|
| 515 | - { |
|
| 500 | + public function reset() { |
|
| 516 | 501 | $this->elements = []; |
| 517 | 502 | $this->records = []; |
| 518 | 503 | $this->metadata = []; |
@@ -528,8 +513,7 @@ discard block |
||
| 528 | 513 | * |
| 529 | 514 | * @return void |
| 530 | 515 | */ |
| 531 | - public function rewind() |
|
| 532 | - { |
|
| 516 | + public function rewind() { |
|
| 533 | 517 | $this->position = 0; |
| 534 | 518 | } |
| 535 | 519 | |
@@ -542,8 +526,7 @@ discard block |
||
| 542 | 526 | * |
| 543 | 527 | * @return void |
| 544 | 528 | */ |
| 545 | - public function save($pid = 0) |
|
| 546 | - { |
|
| 529 | + public function save($pid = 0) { |
|
| 547 | 530 | $pid = max(intval($pid), 0); |
| 548 | 531 | // If no PID is given, save to the user's session instead |
| 549 | 532 | if ($pid > 0) { |
@@ -560,8 +543,7 @@ discard block |
||
| 560 | 543 | * |
| 561 | 544 | * @return bool true on success or false on failure |
| 562 | 545 | */ |
| 563 | - protected function solrConnect() |
|
| 564 | - { |
|
| 546 | + protected function solrConnect() { |
|
| 565 | 547 | // Get Solr instance. |
| 566 | 548 | if (!$this->solr) { |
| 567 | 549 | // Connect to Solr server. |
@@ -607,8 +589,7 @@ discard block |
||
| 607 | 589 | * |
| 608 | 590 | * @return void |
| 609 | 591 | */ |
| 610 | - public function sort($by, $asc = true) |
|
| 611 | - { |
|
| 592 | + public function sort($by, $asc = true) { |
|
| 612 | 593 | $newOrder = []; |
| 613 | 594 | $nonSortable = []; |
| 614 | 595 | foreach ($this->elements as $num => $element) { |
@@ -645,8 +626,7 @@ discard block |
||
| 645 | 626 | * |
| 646 | 627 | * @return void |
| 647 | 628 | */ |
| 648 | - public function offsetUnset($offset) |
|
| 649 | - { |
|
| 629 | + public function offsetUnset($offset) { |
|
| 650 | 630 | unset($this->elements[$offset]); |
| 651 | 631 | // Re-number the elements. |
| 652 | 632 | $this->elements = array_values($this->elements); |
@@ -661,8 +641,7 @@ discard block |
||
| 661 | 641 | * |
| 662 | 642 | * @return bool Is the current list position valid? |
| 663 | 643 | */ |
| 664 | - public function valid() |
|
| 665 | - { |
|
| 644 | + public function valid() { |
|
| 666 | 645 | return isset($this->elements[$this->position]); |
| 667 | 646 | } |
| 668 | 647 | |
@@ -673,8 +652,7 @@ discard block |
||
| 673 | 652 | * |
| 674 | 653 | * @return array The list's metadata |
| 675 | 654 | */ |
| 676 | - protected function _getMetadata() |
|
| 677 | - { |
|
| 655 | + protected function _getMetadata() { |
|
| 678 | 656 | return $this->metadata; |
| 679 | 657 | } |
| 680 | 658 | |
@@ -687,8 +665,7 @@ discard block |
||
| 687 | 665 | * |
| 688 | 666 | * @return void |
| 689 | 667 | */ |
| 690 | - protected function _setMetadata(array $metadata = []) |
|
| 691 | - { |
|
| 668 | + protected function _setMetadata(array $metadata = []) { |
|
| 692 | 669 | $this->metadata = $metadata; |
| 693 | 670 | } |
| 694 | 671 | |
@@ -702,8 +679,7 @@ discard block |
||
| 702 | 679 | * |
| 703 | 680 | * @return void |
| 704 | 681 | */ |
| 705 | - public function __construct(array $elements = [], array $metadata = []) |
|
| 706 | - { |
|
| 682 | + public function __construct(array $elements = [], array $metadata = []) { |
|
| 707 | 683 | if ( |
| 708 | 684 | empty($elements) |
| 709 | 685 | && empty($metadata) |
@@ -735,8 +711,7 @@ discard block |
||
| 735 | 711 | * |
| 736 | 712 | * @return void |
| 737 | 713 | */ |
| 738 | - protected function __clone() |
|
| 739 | - { |
|
| 714 | + protected function __clone() { |
|
| 740 | 715 | // This method is defined as protected because singleton objects should not be cloned. |
| 741 | 716 | } |
| 742 | 717 | |
@@ -749,8 +724,7 @@ discard block |
||
| 749 | 724 | * |
| 750 | 725 | * @return mixed Value of $this->$var |
| 751 | 726 | */ |
| 752 | - public function __get($var) |
|
| 753 | - { |
|
| 727 | + public function __get($var) { |
|
| 754 | 728 | $method = '_get' . ucfirst($var); |
| 755 | 729 | if ( |
| 756 | 730 | !property_exists($this, $var) |
@@ -772,8 +746,7 @@ discard block |
||
| 772 | 746 | * |
| 773 | 747 | * @return bool true if variable is set and not empty, false otherwise |
| 774 | 748 | */ |
| 775 | - public function __isset($var) |
|
| 776 | - { |
|
| 749 | + public function __isset($var) { |
|
| 777 | 750 | return !empty($this->__get($var)); |
| 778 | 751 | } |
| 779 | 752 | |
@@ -787,8 +760,7 @@ discard block |
||
| 787 | 760 | * |
| 788 | 761 | * @return void |
| 789 | 762 | */ |
| 790 | - public function __set($var, $value) |
|
| 791 | - { |
|
| 763 | + public function __set($var, $value) { |
|
| 792 | 764 | $method = '_set' . ucfirst($var); |
| 793 | 765 | if ( |
| 794 | 766 | !property_exists($this, $var) |
@@ -808,8 +780,7 @@ discard block |
||
| 808 | 780 | * |
| 809 | 781 | * @return array Properties to be serialized |
| 810 | 782 | */ |
| 811 | - public function __sleep() |
|
| 812 | - { |
|
| 783 | + public function __sleep() { |
|
| 813 | 784 | return ['elements', 'metadata']; |
| 814 | 785 | } |
| 815 | 786 | |
@@ -821,8 +792,7 @@ discard block |
||
| 821 | 792 | * |
| 822 | 793 | * @return void |
| 823 | 794 | */ |
| 824 | - public function __wakeup() |
|
| 825 | - { |
|
| 795 | + public function __wakeup() { |
|
| 826 | 796 | $this->count = count($this->elements); |
| 827 | 797 | } |
| 828 | 798 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if ($resArray['uid'] == $record['uid']) { |
| 218 | 218 | $record['thumbnail'] = $resArray['thumbnail']; |
| 219 | 219 | $record['metadata'] = $metadata; |
| 220 | - } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], true)) !== false) { |
|
| 220 | + } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], TRUE)) !== FALSE) { |
|
| 221 | 221 | $record['subparts'][$key] = [ |
| 222 | 222 | 'uid' => $resArray['uid'], |
| 223 | 223 | 'page' => 1, |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | 'highlighting' => [ |
| 245 | 245 | 'query' => Solr::escapeQuery($this->metadata['searchString']), |
| 246 | 246 | 'field' => 'fulltext', |
| 247 | - 'usefastvectorhighlighter' => true |
|
| 247 | + 'usefastvectorhighlighter' => TRUE |
|
| 248 | 248 | ] |
| 249 | 249 | ]; |
| 250 | 250 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $record['thumbnail'] = $resArray->thumbnail; |
| 289 | 289 | $record['metadata'] = $metadata; |
| 290 | 290 | } else { |
| 291 | - $highlightedDoc = !empty($highlighting) ? $highlighting->getResult($resArray->id) : null; |
|
| 291 | + $highlightedDoc = !empty($highlighting) ? $highlighting->getResult($resArray->id) : NULL; |
|
| 292 | 292 | $highlight = !empty($highlightedDoc) ? $highlightedDoc->getField('fulltext')[0] : ''; |
| 293 | 293 | $record['subparts'][$resArray->id] = [ |
| 294 | 294 | 'uid' => $resArray->uid, |
@@ -591,10 +591,10 @@ discard block |
||
| 591 | 591 | // Add static fields. |
| 592 | 592 | $this->solrConfig['type'] = 'type'; |
| 593 | 593 | } else { |
| 594 | - return false; |
|
| 594 | + return FALSE; |
|
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | - return true; |
|
| 597 | + return TRUE; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | /** |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | * |
| 608 | 608 | * @return void |
| 609 | 609 | */ |
| 610 | - public function sort($by, $asc = true) |
|
| 610 | + public function sort($by, $asc = TRUE) |
|
| 611 | 611 | { |
| 612 | 612 | $newOrder = []; |
| 613 | 613 | $nonSortable = []; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if ($this->valid()) { |
| 138 | 138 | return $this->getRecord($this->elements[$this->position]); |
| 139 | 139 | } else { |
| 140 | - $this->logger->notice('Invalid position "' . $this->position . '" for list element'); |
|
| 140 | + $this->logger->notice('Invalid position "'.$this->position.'" for list element'); |
|
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | // Restrict the fields to the required ones |
| 242 | 242 | $params['fields'] = 'uid,id,toplevel,thumbnail,page'; |
| 243 | 243 | foreach ($this->solrConfig as $solr_name) { |
| 244 | - $params['fields'] .= ',' . $solr_name; |
|
| 244 | + $params['fields'] .= ','.$solr_name; |
|
| 245 | 245 | } |
| 246 | 246 | // If it is a fulltext search, enable highlighting. |
| 247 | 247 | if ($this->metadata['fulltextSearch']) { |
@@ -263,15 +263,15 @@ discard block |
||
| 263 | 263 | // Extend filter query to get all documents with the same UID. |
| 264 | 264 | foreach ($params['filterquery'] as $key => $value) { |
| 265 | 265 | if (isset($value['query'])) { |
| 266 | - $params['filterquery'][$key]['query'] = $value['query'] . ' OR toplevel:true'; |
|
| 266 | + $params['filterquery'][$key]['query'] = $value['query'].' OR toplevel:true'; |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | // Add filter query to get all documents with the required uid. |
| 270 | - $params['filterquery'][] = ['query' => 'uid:' . Solr::escapeQuery($record['uid'])]; |
|
| 270 | + $params['filterquery'][] = ['query' => 'uid:'.Solr::escapeQuery($record['uid'])]; |
|
| 271 | 271 | // Add sorting. |
| 272 | 272 | $params['sort'] = $this->metadata['options']['params']['sort']; |
| 273 | 273 | // Set query. |
| 274 | - $params['query'] = $this->metadata['options']['select'] . ' OR toplevel:true'; |
|
| 274 | + $params['query'] = $this->metadata['options']['select'].' OR toplevel:true'; |
|
| 275 | 275 | // Perform search for all documents with the same uid that either fit to the search or marked as toplevel. |
| 276 | 276 | $selectQuery = $this->solr->service->createSelect($params); |
| 277 | 277 | $result = $this->solr->service->select($selectQuery); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $position < 0 |
| 347 | 347 | || $position >= $this->count |
| 348 | 348 | ) { |
| 349 | - $this->logger->warning('Invalid position "' . $position . '" for element moving'); |
|
| 349 | + $this->logger->warning('Invalid position "'.$position.'" for element moving'); |
|
| 350 | 350 | return; |
| 351 | 351 | } |
| 352 | 352 | $steps = intval($steps); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | if (($position + $steps) < 0 |
| 355 | 355 | || ($position + $steps) >= $this->count |
| 356 | 356 | ) { |
| 357 | - $this->logger->warning('Invalid steps "' . $steps . '" for moving element at position "' . $position . '"'); |
|
| 357 | + $this->logger->warning('Invalid steps "'.$steps.'" for moving element at position "'.$position.'"'); |
|
| 358 | 358 | return; |
| 359 | 359 | } |
| 360 | 360 | $element = $this->remove($position); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | if ($this->offsetExists($offset)) { |
| 433 | 433 | return $this->getRecord($this->elements[$offset]); |
| 434 | 434 | } else { |
| 435 | - $this->logger->notice('Invalid offset "' . $offset . '" for list element'); |
|
| 435 | + $this->logger->notice('Invalid offset "'.$offset.'" for list element'); |
|
| 436 | 436 | return; |
| 437 | 437 | } |
| 438 | 438 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $position < 0 |
| 477 | 477 | || $position >= $this->count |
| 478 | 478 | ) { |
| 479 | - $this->logger->warning('Invalid position "' . $position . '" for element removing'); |
|
| 479 | + $this->logger->warning('Invalid position "'.$position.'" for element removing'); |
|
| 480 | 480 | return; |
| 481 | 481 | } |
| 482 | 482 | $removed = array_splice($this->elements, $position, 1); |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | $position < 0 |
| 502 | 502 | || $position >= $this->count |
| 503 | 503 | ) { |
| 504 | - $this->logger->warning('Invalid position "' . $position . '" for element removing'); |
|
| 504 | + $this->logger->warning('Invalid position "'.$position.'" for element removing'); |
|
| 505 | 505 | return; |
| 506 | 506 | } |
| 507 | 507 | $removed = array_splice($this->elements, $position, $length); |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | ->execute(); |
| 595 | 595 | |
| 596 | 596 | while ($resArray = $result->fetch()) { |
| 597 | - $this->solrConfig[$resArray['index_name']] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . 's' . ($resArray['index_indexed'] ? 'i' : 'u'); |
|
| 597 | + $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u'); |
|
| 598 | 598 | } |
| 599 | 599 | // Add static fields. |
| 600 | 600 | $this->solrConfig['type'] = 'type'; |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | foreach ($this->elements as $num => $element) { |
| 623 | 623 | // Is this element sortable? |
| 624 | 624 | if (!empty($element['s'][$by])) { |
| 625 | - $newOrder[$element['s'][$by] . str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
| 625 | + $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
| 626 | 626 | } else { |
| 627 | 627 | $nonSortable[] = $element; |
| 628 | 628 | } |
@@ -760,12 +760,12 @@ discard block |
||
| 760 | 760 | */ |
| 761 | 761 | public function __get($var) |
| 762 | 762 | { |
| 763 | - $method = '_get' . ucfirst($var); |
|
| 763 | + $method = '_get'.ucfirst($var); |
|
| 764 | 764 | if ( |
| 765 | 765 | !property_exists($this, $var) |
| 766 | 766 | || !method_exists($this, $method) |
| 767 | 767 | ) { |
| 768 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 768 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 769 | 769 | return; |
| 770 | 770 | } else { |
| 771 | 771 | return $this->$method(); |
@@ -798,12 +798,12 @@ discard block |
||
| 798 | 798 | */ |
| 799 | 799 | public function __set($var, $value) |
| 800 | 800 | { |
| 801 | - $method = '_set' . ucfirst($var); |
|
| 801 | + $method = '_set'.ucfirst($var); |
|
| 802 | 802 | if ( |
| 803 | 803 | !property_exists($this, $var) |
| 804 | 804 | || !method_exists($this, $method) |
| 805 | 805 | ) { |
| 806 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 806 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 807 | 807 | } else { |
| 808 | 808 | $this->$method($value); |
| 809 | 809 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function getClass(FlashMessage $flashMessage): string |
| 67 | 67 | { |
| 68 | - return 'alert-' . self::$classes[$flashMessage->getSeverity()]; |
|
| 68 | + return 'alert-'.self::$classes[$flashMessage->getSeverity()]; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | $markup[] = '<div class="typo3-messages">'; |
| 96 | 96 | foreach ($flashMessages as $flashMessage) { |
| 97 | 97 | $messageTitle = $flashMessage->getTitle(); |
| 98 | - $markup[] = '<div class="alert ' . htmlspecialchars($this->getClass($flashMessage)) . '">'; |
|
| 98 | + $markup[] = '<div class="alert '.htmlspecialchars($this->getClass($flashMessage)).'">'; |
|
| 99 | 99 | $markup[] = ' <div class="media">'; |
| 100 | 100 | $markup[] = ' <div class="media-left">'; |
| 101 | 101 | $markup[] = ' <span class="fa-stack fa-lg">'; |
| 102 | 102 | $markup[] = ' <i class="fa fa-circle fa-stack-2x"></i>'; |
| 103 | - $markup[] = ' <i class="fa fa-' . htmlspecialchars($this->getIconName($flashMessage)) . ' fa-stack-1x"></i>'; |
|
| 103 | + $markup[] = ' <i class="fa fa-'.htmlspecialchars($this->getIconName($flashMessage)).' fa-stack-1x"></i>'; |
|
| 104 | 104 | $markup[] = ' </span>'; |
| 105 | 105 | $markup[] = ' </div>'; |
| 106 | 106 | $markup[] = ' <div class="media-body">'; |
| 107 | 107 | if ($messageTitle !== '') { |
| 108 | - $markup[] = ' <h4 class="alert-title">' . htmlspecialchars($messageTitle) . '</h4>'; |
|
| 108 | + $markup[] = ' <h4 class="alert-title">'.htmlspecialchars($messageTitle).'</h4>'; |
|
| 109 | 109 | } |
| 110 | - $markup[] = ' <p class="alert-message">' . $flashMessage->getMessage() . '</p>'; |
|
| 110 | + $markup[] = ' <p class="alert-message">'.$flashMessage->getMessage().'</p>'; |
|
| 111 | 111 | $markup[] = ' </div>'; |
| 112 | 112 | $markup[] = ' </div>'; |
| 113 | 113 | $markup[] = '</div>'; |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | * The created output contains all classes which are required for |
| 22 | 22 | * the TYPO3 backend. Any kind of message contains also a nice icon. |
| 23 | 23 | */ |
| 24 | -class KitodoFlashMessageRenderer implements \TYPO3\CMS\Core\Messaging\Renderer\FlashMessageRendererInterface |
|
| 25 | -{ |
|
| 24 | +class KitodoFlashMessageRenderer implements \TYPO3\CMS\Core\Messaging\Renderer\FlashMessageRendererInterface { |
|
| 26 | 25 | /** |
| 27 | 26 | * @var string The message severity class names |
| 28 | 27 | */ |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | * @subpackage dlf |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -class ext_update |
|
| 27 | -{ |
|
| 26 | +class ext_update { |
|
| 28 | 27 | /** |
| 29 | 28 | * This holds the output ready to return |
| 30 | 29 | * |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | foreach ($rows as $row) { |
| 118 | 118 | if ($row['format'] === 0 && $row['xpath']) { |
| 119 | - $uids[] = (int)$row['uid']; |
|
| 119 | + $uids[] = (int) $row['uid']; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | return $uids; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $result = $queryBuilder |
| 225 | 225 | ->select('COLUMN_NAME') |
| 226 | 226 | ->from('INFORMATION_SCHEMA.COLUMNS') |
| 227 | - ->where('TABLE_NAME="tx_dlf_documents" AND TABLE_SCHEMA="' . $database . '" AND COLUMN_NAME="document_format"') |
|
| 227 | + ->where('TABLE_NAME="tx_dlf_documents" AND TABLE_SCHEMA="'.$database.'" AND COLUMN_NAME="document_format"') |
|
| 228 | 228 | ->execute(); |
| 229 | 229 | while ($resArray = $result->fetch()) { |
| 230 | 230 | if ($resArray['COLUMN_NAME'] === 'document_format') { |
@@ -43,21 +43,21 @@ discard block |
||
| 43 | 43 | public function access(): bool |
| 44 | 44 | { |
| 45 | 45 | if (count($this->getMetadataConfig())) { |
| 46 | - return true; |
|
| 46 | + return TRUE; |
|
| 47 | 47 | } |
| 48 | 48 | if ($this->oldIndexRelatedTableNames()) { |
| 49 | - return true; |
|
| 49 | + return TRUE; |
|
| 50 | 50 | } |
| 51 | 51 | if ($this->solariumSolrUpdateRequired()) { |
| 52 | - return true; |
|
| 52 | + return TRUE; |
|
| 53 | 53 | } |
| 54 | 54 | if (count($this->oldFormatClasses())) { |
| 55 | - return true; |
|
| 55 | + return TRUE; |
|
| 56 | 56 | } |
| 57 | 57 | if ($this->hasNoFormatForDocument()) { |
| 58 | - return true; |
|
| 58 | + return TRUE; |
|
| 59 | 59 | } |
| 60 | - return false; |
|
| 60 | + return FALSE; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | // Instantiate search object. |
| 143 | 143 | $solr = Solr::getInstance($resArray['index_name']); |
| 144 | 144 | if (!$solr->ready) { |
| 145 | - return true; |
|
| 145 | + return TRUE; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | - return false; |
|
| 148 | + return FALSE; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | || $resArray['column_name'] === 'boost' |
| 202 | 202 | || $resArray['column_name'] === 'autocomplete' |
| 203 | 203 | ) { |
| 204 | - return true; |
|
| 204 | + return TRUE; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | - return false; |
|
| 207 | + return FALSE; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param bool $checkStructureOnly |
| 215 | 215 | * @return bool |
| 216 | 216 | */ |
| 217 | - protected function hasNoFormatForDocument($checkStructureOnly = false): bool |
|
| 217 | + protected function hasNoFormatForDocument($checkStructureOnly = FALSE): bool |
|
| 218 | 218 | { |
| 219 | 219 | // Check if column "document_format" exists. |
| 220 | 220 | $database = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | while ($resArray = $result->fetch()) { |
| 230 | 230 | if ($resArray['COLUMN_NAME'] === 'document_format') { |
| 231 | 231 | if ($checkStructureOnly) { |
| 232 | - return false; |
|
| 232 | + return FALSE; |
|
| 233 | 233 | } |
| 234 | 234 | // Check if column has empty fields. |
| 235 | 235 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('INFORMATION_SCHEMA.COLUMNS'); |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | ->fetchColumn(0); |
| 242 | 242 | |
| 243 | 243 | if ($count === 0) { |
| 244 | - return false; |
|
| 244 | + return FALSE; |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - return true; |
|
| 248 | + return TRUE; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | protected function doSolariumSolrUpdate(): void |
| 397 | 397 | { |
| 398 | - $error = false; |
|
| 398 | + $error = FALSE; |
|
| 399 | 399 | // Get all Solr cores that were not deleted. |
| 400 | 400 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_solrcores'); |
| 401 | 401 | $result = $queryBuilder |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR |
| 413 | 413 | ); |
| 414 | 414 | $this->content .= Helper::renderFlashMessages(); |
| 415 | - $error = true; |
|
| 415 | + $error = TRUE; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | if (!$error) { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | ->update('tx_dlf_documents') |
| 440 | 440 | ->where( |
| 441 | 441 | $queryBuilder->expr()->orX( |
| 442 | - $queryBuilder->expr()->eq('document_format', $queryBuilder->createNamedParameter(null)), |
|
| 442 | + $queryBuilder->expr()->eq('document_format', $queryBuilder->createNamedParameter(NULL)), |
|
| 443 | 443 | $queryBuilder->expr()->eq('document_format', $queryBuilder->createNamedParameter('')) |
| 444 | 444 | ) |
| 445 | 445 | ) |