Passed
Pull Request — master (#86)
by
unknown
02:39
created
Classes/Plugin/Tools/SearchInDocumentTool.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage dlf
27 27
  * @access public
28 28
  */
29
-class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin
30
-{
29
+class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin {
31 30
     public $scriptRelPath = 'Classes/Plugin/Tools/SearchInDocumentTool.php';
32 31
 
33 32
     /**
@@ -40,8 +39,7 @@  discard block
 block discarded – undo
40 39
      *
41 40
      * @return string The content that is displayed on the website
42 41
      */
43
-    public function main($content, $conf)
44
-    {
42
+    public function main($content, $conf) {
45 43
 
46 44
         $this->init($conf);
47 45
 
@@ -126,8 +124,7 @@  discard block
 block discarded – undo
126 124
      *
127 125
      * @return string with action url for search form
128 126
      */
129
-    protected function getActionUrl()
130
-    {
127
+    protected function getActionUrl() {
131 128
         // Configure @action URL for form.
132 129
         $linkConf = [
133 130
             'parameter' => $GLOBALS['TSFE']->id,
@@ -152,8 +149,7 @@  discard block
 block discarded – undo
152 149
      *
153 150
      * @return string with current document id
154 151
      */
155
-    protected function getCurrentDocumentId()
156
-    {
152
+    protected function getCurrentDocumentId() {
157 153
         $id = $this->doc->uid;
158 154
 
159 155
         // example: https://host.de/items/*id*/record
@@ -177,8 +173,7 @@  discard block
 block discarded – undo
177 173
      *
178 174
      * @return string with encrypted core name
179 175
      */
180
-    protected function getEncryptedCoreName()
181
-    {
176
+    protected function getEncryptedCoreName() {
182 177
         // Get core name.
183 178
         $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores');
184 179
         // Encrypt core name.
Please login to merge, or discard this patch.
Classes/Plugin/Eid/SearchInDocument.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@  discard block
 block discarded – undo
28 28
  * @subpackage dlf
29 29
  * @access public
30 30
  */
31
-class SearchInDocument
32
-{
31
+class SearchInDocument {
33 32
     /**
34 33
      * The main method of the eID script
35 34
      *
36 35
      * @param ServerRequestInterface $request
37 36
      * @return ResponseInterface JSON response of search suggestions
38 37
      */
39
-    public function main(ServerRequestInterface $request)
40
-    {
38
+    public function main(ServerRequestInterface $request) {
41 39
         $output = [
42 40
             'documents' => [],
43 41
             'numFound' => 0
@@ -118,8 +116,7 @@  discard block
 block discarded – undo
118 116
      *
119 117
      * @return string SOLR query
120 118
      */
121
-    private function getQuery($fields, $parameters)
122
-    {
119
+    private function getQuery($fields, $parameters) {
123 120
         return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']);
124 121
     }
125 122
 
@@ -133,8 +130,7 @@  discard block
 block discarded – undo
133 130
      *
134 131
      * @return int|string uid of the document
135 132
      */
136
-    private function getUid($uid)
137
-    {
133
+    private function getUid($uid) {
138 134
         return is_numeric($uid) ? intval($uid) : $uid;
139 135
     }
140 136
 }
Please login to merge, or discard this patch.
Classes/Common/Document.php 1 patch
Braces   +33 added lines, -66 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
  * @property-read mixed $uid This holds the UID or the URL of the document
49 49
  * @abstract
50 50
  */
51
-abstract class Document
52
-{
51
+abstract class Document {
53 52
     /**
54 53
      * This holds the logger
55 54
      *
@@ -341,8 +340,7 @@  discard block
 block discarded – undo
341 340
      *
342 341
      * @return void
343 342
      */
344
-    public static function clearRegistry()
345
-    {
343
+    public static function clearRegistry() {
346 344
         // Reset registry array.
347 345
         self::$registry = [];
348 346
     }
@@ -617,8 +615,7 @@  discard block
 block discarded – undo
617 615
      *
618 616
      * @return int The physical page number
619 617
      */
620
-    public function getPhysicalPage($logicalPage)
621
-    {
618
+    public function getPhysicalPage($logicalPage) {
622 619
         if (
623 620
             !empty($this->lastSearchedPhysicalPage['logicalPage'])
624 621
             && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage
@@ -663,8 +660,7 @@  discard block
 block discarded – undo
663 660
      *
664 661
      * @return string The OCR full text
665 662
      */
666
-    protected function getFullTextFromXml($id)
667
-    {
663
+    protected function getFullTextFromXml($id) {
668 664
         $fullText = '';
669 665
         // Load available text formats, ...
670 666
         $this->loadFormats();
@@ -726,8 +722,7 @@  discard block
 block discarded – undo
726 722
      *
727 723
      * @return string The format of the OCR full text
728 724
      */
729
-    private function getTextFormat($fileContent)
730
-    {
725
+    private function getTextFormat($fileContent) {
731 726
         // Get the root element's name as text format.
732 727
         return strtoupper($this->getXmlObject($fileContent)->getName());
733 728
     }
@@ -741,8 +736,7 @@  discard block
 block discarded – undo
741 736
      *
742 737
      * @return \SimpleXMLElement The OCR full text as object
743 738
      */
744
-    private function getXmlObject($fileContent)
745
-    {
739
+    private function getXmlObject($fileContent) {
746 740
         // Turn off libxml's error logging.
747 741
         $libxmlErrors = libxml_use_internal_errors(true);
748 742
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept.
@@ -769,8 +763,7 @@  discard block
 block discarded – undo
769 763
      *
770 764
      * @return string The title of the document itself or a parent document
771 765
      */
772
-    public static function getTitle($uid, $recursive = false)
773
-    {
766
+    public static function getTitle($uid, $recursive = false) {
774 767
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
775 768
 
776 769
         $title = '';
@@ -824,8 +817,7 @@  discard block
 block discarded – undo
824 817
      *
825 818
      * @return array The logical structure node's / resource's parsed metadata array
826 819
      */
827
-    public function getTitledata($cPid = 0)
828
-    {
820
+    public function getTitledata($cPid = 0) {
829 821
         $titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
830 822
         // Add information from METS structural map to titledata array.
831 823
         if ($this instanceof MetsDocument) {
@@ -858,8 +850,7 @@  discard block
 block discarded – undo
858 850
      * @return int|bool: false if structure with $logId is not a child of this substructure,
859 851
      * or the actual depth.
860 852
      */
861
-    protected function getTreeDepth($structure, $depth, $logId)
862
-    {
853
+    protected function getTreeDepth($structure, $depth, $logId) {
863 854
         foreach ($structure as $element) {
864 855
             if ($element['id'] == $logId) {
865 856
                 return $depth;
@@ -881,8 +872,7 @@  discard block
 block discarded – undo
881 872
      * @param string $logId: The id of the logical structure element whose depth is requested
882 873
      * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC.
883 874
      */
884
-    public function getStructureDepth($logId)
885
-    {
875
+    public function getStructureDepth($logId) {
886 876
         return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId);
887 877
     }
888 878
 
@@ -932,8 +922,7 @@  discard block
 block discarded – undo
932 922
      *
933 923
      * @return bool true on success or false on failure
934 924
      */
935
-    protected function load($location)
936
-    {
925
+    protected function load($location) {
937 926
         // Load XML / JSON-LD file.
938 927
         if (GeneralUtility::isValidUrl($location)) {
939 928
             // Load extension configuration
@@ -966,8 +955,7 @@  discard block
 block discarded – undo
966 955
      *
967 956
      * @return void
968 957
      */
969
-    protected function loadFormats()
970
-    {
958
+    protected function loadFormats() {
971 959
         if (!$this->formatsLoaded) {
972 960
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
973 961
                 ->getQueryBuilderForTable('tx_dlf_formats');
@@ -1007,8 +995,7 @@  discard block
 block discarded – undo
1007 995
      *
1008 996
      * @return void
1009 997
      */
1010
-    public function registerNamespaces(&$obj)
1011
-    {
998
+    public function registerNamespaces(&$obj) {
1012 999
         // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions.
1013 1000
         $this->loadFormats();
1014 1001
         // Do we have a \SimpleXMLElement or \DOMXPath object?
@@ -1037,8 +1024,7 @@  discard block
 block discarded – undo
1037 1024
      *
1038 1025
      * @return bool true on success or false on failure
1039 1026
      */
1040
-    public function save($pid = 0, $core = 0, $owner = null)
1041
-    {
1027
+    public function save($pid = 0, $core = 0, $owner = null) {
1042 1028
         if (\TYPO3_MODE !== 'BE') {
1043 1029
             $this->logger->error('Saving a document is only allowed in the backend');
1044 1030
             return false;
@@ -1366,8 +1352,7 @@  discard block
 block discarded – undo
1366 1352
      *
1367 1353
      * @return int The PID of the metadata definitions
1368 1354
      */
1369
-    protected function _getCPid()
1370
-    {
1355
+    protected function _getCPid() {
1371 1356
         return $this->cPid;
1372 1357
     }
1373 1358
 
@@ -1378,8 +1363,7 @@  discard block
 block discarded – undo
1378 1363
      *
1379 1364
      * @return bool Are there any fulltext files available?
1380 1365
      */
1381
-    protected function _getHasFulltext()
1382
-    {
1366
+    protected function _getHasFulltext() {
1383 1367
         $this->ensureHasFulltextIsSet();
1384 1368
         return $this->hasFulltext;
1385 1369
     }
@@ -1391,8 +1375,7 @@  discard block
 block discarded – undo
1391 1375
      *
1392 1376
      * @return string The location of the document
1393 1377
      */
1394
-    protected function _getLocation()
1395
-    {
1378
+    protected function _getLocation() {
1396 1379
         return $this->location;
1397 1380
     }
1398 1381
 
@@ -1414,8 +1397,7 @@  discard block
 block discarded – undo
1414 1397
      *
1415 1398
      * @return array Array of metadata with their corresponding logical structure node ID as key
1416 1399
      */
1417
-    protected function _getMetadataArray()
1418
-    {
1400
+    protected function _getMetadataArray() {
1419 1401
         // Set metadata definitions' PID.
1420 1402
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
1421 1403
         if (!$cPid) {
@@ -1440,8 +1422,7 @@  discard block
 block discarded – undo
1440 1422
      *
1441 1423
      * @return int The total number of pages and/or tracks
1442 1424
      */
1443
-    protected function _getNumPages()
1444
-    {
1425
+    protected function _getNumPages() {
1445 1426
         $this->_getPhysicalStructure();
1446 1427
         return $this->numPages;
1447 1428
     }
@@ -1453,8 +1434,7 @@  discard block
 block discarded – undo
1453 1434
      *
1454 1435
      * @return int The UID of the parent document or zero if not applicable
1455 1436
      */
1456
-    protected function _getParentId()
1457
-    {
1437
+    protected function _getParentId() {
1458 1438
         return $this->parentId;
1459 1439
     }
1460 1440
 
@@ -1477,8 +1457,7 @@  discard block
 block discarded – undo
1477 1457
      *
1478 1458
      * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order
1479 1459
      */
1480
-    protected function _getPhysicalStructureInfo()
1481
-    {
1460
+    protected function _getPhysicalStructureInfo() {
1482 1461
         // Is there no physical structure array yet?
1483 1462
         if (!$this->physicalStructureLoaded) {
1484 1463
             // Build physical structure array.
@@ -1494,8 +1473,7 @@  discard block
 block discarded – undo
1494 1473
      *
1495 1474
      * @return int The PID of the document or zero if not in database
1496 1475
      */
1497
-    protected function _getPid()
1498
-    {
1476
+    protected function _getPid() {
1499 1477
         return $this->pid;
1500 1478
     }
1501 1479
 
@@ -1506,8 +1484,7 @@  discard block
 block discarded – undo
1506 1484
      *
1507 1485
      * @return bool Is the document instantiated successfully?
1508 1486
      */
1509
-    protected function _getReady()
1510
-    {
1487
+    protected function _getReady() {
1511 1488
         return $this->ready;
1512 1489
     }
1513 1490
 
@@ -1518,8 +1495,7 @@  discard block
 block discarded – undo
1518 1495
      *
1519 1496
      * @return mixed The METS file's / IIIF manifest's record identifier
1520 1497
      */
1521
-    protected function _getRecordId()
1522
-    {
1498
+    protected function _getRecordId() {
1523 1499
         return $this->recordId;
1524 1500
     }
1525 1501
 
@@ -1530,8 +1506,7 @@  discard block
 block discarded – undo
1530 1506
      *
1531 1507
      * @return int The UID of the root document or zero if not applicable
1532 1508
      */
1533
-    protected function _getRootId()
1534
-    {
1509
+    protected function _getRootId() {
1535 1510
         if (!$this->rootIdLoaded) {
1536 1511
             if ($this->parentId) {
1537 1512
                 $parent = self::getInstance($this->parentId, $this->pid);
@@ -1561,8 +1536,7 @@  discard block
 block discarded – undo
1561 1536
      *
1562 1537
      * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved
1563 1538
      */
1564
-    protected function _getTableOfContents()
1565
-    {
1539
+    protected function _getTableOfContents() {
1566 1540
         // Is there no logical structure array yet?
1567 1541
         if (!$this->tableOfContentsLoaded) {
1568 1542
             // Get all logical structures.
@@ -1603,8 +1577,7 @@  discard block
 block discarded – undo
1603 1577
      *
1604 1578
      * @return mixed The UID or the URL of the document
1605 1579
      */
1606
-    protected function _getUid()
1607
-    {
1580
+    protected function _getUid() {
1608 1581
         return $this->uid;
1609 1582
     }
1610 1583
 
@@ -1617,8 +1590,7 @@  discard block
 block discarded – undo
1617 1590
      *
1618 1591
      * @return void
1619 1592
      */
1620
-    protected function _setCPid($value)
1621
-    {
1593
+    protected function _setCPid($value) {
1622 1594
         $this->cPid = max(intval($value), 0);
1623 1595
     }
1624 1596
 
@@ -1629,8 +1601,7 @@  discard block
 block discarded – undo
1629 1601
      *
1630 1602
      * @return void
1631 1603
      */
1632
-    protected function __clone()
1633
-    {
1604
+    protected function __clone() {
1634 1605
         // This method is defined as protected because singleton objects should not be cloned.
1635 1606
     }
1636 1607
 
@@ -1647,8 +1618,7 @@  discard block
 block discarded – undo
1647 1618
      *
1648 1619
      * @return void
1649 1620
      */
1650
-    protected function __construct($uid, $pid, $preloadedDocument)
1651
-    {
1621
+    protected function __construct($uid, $pid, $preloadedDocument) {
1652 1622
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1653 1623
             ->getQueryBuilderForTable('tx_dlf_documents');
1654 1624
         $location = '';
@@ -1760,8 +1730,7 @@  discard block
 block discarded – undo
1760 1730
      *
1761 1731
      * @return mixed Value of $this->$var
1762 1732
      */
1763
-    public function __get($var)
1764
-    {
1733
+    public function __get($var) {
1765 1734
         $method = '_get' . ucfirst($var);
1766 1735
         if (
1767 1736
             !property_exists($this, $var)
@@ -1783,8 +1752,7 @@  discard block
 block discarded – undo
1783 1752
      *
1784 1753
      * @return bool true if variable is set and not empty, false otherwise
1785 1754
      */
1786
-    public function __isset($var)
1787
-    {
1755
+    public function __isset($var) {
1788 1756
         return !empty($this->__get($var));
1789 1757
     }
1790 1758
 
@@ -1798,8 +1766,7 @@  discard block
 block discarded – undo
1798 1766
      *
1799 1767
      * @return void
1800 1768
      */
1801
-    public function __set($var, $value)
1802
-    {
1769
+    public function __set($var, $value) {
1803 1770
         $method = '_set' . ucfirst($var);
1804 1771
         if (
1805 1772
             !property_exists($this, $var)
Please login to merge, or discard this patch.
Classes/Common/DocumentList.php 1 patch
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@  discard block
 block discarded – undo
104 104
      *
105 105
      * @return void
106 106
      */
107
-    public function add(array $elements, $position = -1)
108
-    {
107
+    public function add(array $elements, $position = -1) {
109 108
         $position = MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count);
110 109
         if (!empty($elements)) {
111 110
             array_splice($this->elements, $position, 0, $elements);
@@ -121,8 +120,7 @@  discard block
 block discarded – undo
121 120
      *
122 121
      * @return int The number of elements in the list
123 122
      */
124
-    public function count()
125
-    {
123
+    public function count() {
126 124
         return $this->count;
127 125
     }
128 126
 
@@ -134,8 +132,7 @@  discard block
 block discarded – undo
134 132
      *
135 133
      * @return array The current element
136 134
      */
137
-    public function current()
138
-    {
135
+    public function current() {
139 136
         if ($this->valid()) {
140 137
             return $this->getRecord($this->elements[$this->position]);
141 138
         } else {
@@ -153,8 +150,7 @@  discard block
 block discarded – undo
153 150
      *
154 151
      * @return mixed The element's full record
155 152
      */
156
-    protected function getRecord($element)
157
-    {
153
+    protected function getRecord($element) {
158 154
         if (
159 155
             is_array($element)
160 156
             && array_keys($element) == ['u', 'h', 's', 'p']
@@ -261,8 +257,7 @@  discard block
 block discarded – undo
261 257
      *
262 258
      * @return Result
263 259
      */
264
-    private function getSolrResult($record)
265
-    {
260
+    private function getSolrResult($record) {
266 261
         $fields = Solr::getFields();
267 262
 
268 263
         $query = $this->solr->service->createSelect();
@@ -334,8 +329,7 @@  discard block
 block discarded – undo
334 329
      *
335 330
      * @return array
336 331
      */
337
-    private function getSolrRecord($record, $result)
338
-    {
332
+    private function getSolrRecord($record, $result) {
339 333
         // If it is a fulltext search, fetch the highlighting results.
340 334
         if ($this->metadata['fulltextSearch']) {
341 335
             $data = $result->getData();
@@ -382,8 +376,7 @@  discard block
 block discarded – undo
382 376
      *
383 377
      * @return int The current position
384 378
      */
385
-    public function key()
386
-    {
379
+    public function key() {
387 380
         return $this->position;
388 381
     }
389 382
 
@@ -397,8 +390,7 @@  discard block
 block discarded – undo
397 390
      *
398 391
      * @return void
399 392
      */
400
-    public function move($position, $steps)
401
-    {
393
+    public function move($position, $steps) {
402 394
         $position = intval($position);
403 395
         // Check if list position is valid.
404 396
         if (
@@ -429,8 +421,7 @@  discard block
 block discarded – undo
429 421
      *
430 422
      * @return void
431 423
      */
432
-    public function moveUp($position)
433
-    {
424
+    public function moveUp($position) {
434 425
         $this->move($position, -1);
435 426
     }
436 427
 
@@ -443,8 +434,7 @@  discard block
 block discarded – undo
443 434
      *
444 435
      * @return void
445 436
      */
446
-    public function moveDown($position)
447
-    {
437
+    public function moveDown($position) {
448 438
         $this->move($position, 1);
449 439
     }
450 440
 
@@ -456,8 +446,7 @@  discard block
 block discarded – undo
456 446
      *
457 447
      * @return void
458 448
      */
459
-    public function next()
460
-    {
449
+    public function next() {
461 450
         $this->position++;
462 451
     }
463 452
 
@@ -471,8 +460,7 @@  discard block
 block discarded – undo
471 460
      *
472 461
      * @return bool Does the given offset exist?
473 462
      */
474
-    public function offsetExists($offset)
475
-    {
463
+    public function offsetExists($offset) {
476 464
         return isset($this->elements[$offset]);
477 465
     }
478 466
 
@@ -486,8 +474,7 @@  discard block
 block discarded – undo
486 474
      *
487 475
      * @return array The element at the given offset
488 476
      */
489
-    public function offsetGet($offset)
490
-    {
477
+    public function offsetGet($offset) {
491 478
         if ($this->offsetExists($offset)) {
492 479
             return $this->getRecord($this->elements[$offset]);
493 480
         } else {
@@ -507,8 +494,7 @@  discard block
 block discarded – undo
507 494
      *
508 495
      * @return void
509 496
      */
510
-    public function offsetSet($offset, $value)
511
-    {
497
+    public function offsetSet($offset, $value) {
512 498
         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) {
513 499
             $this->elements[$offset] = $value;
514 500
         } else {
@@ -528,8 +514,7 @@  discard block
 block discarded – undo
528 514
      *
529 515
      * @return array The removed element
530 516
      */
531
-    public function remove($position)
532
-    {
517
+    public function remove($position) {
533 518
         $position = intval($position);
534 519
         if (
535 520
             $position < 0
@@ -553,8 +538,7 @@  discard block
 block discarded – undo
553 538
      *
554 539
      * @return array The indizes of the removed elements
555 540
      */
556
-    public function removeRange($position, $length)
557
-    {
541
+    public function removeRange($position, $length) {
558 542
         $position = intval($position);
559 543
         if (
560 544
             $position < 0
@@ -575,8 +559,7 @@  discard block
 block discarded – undo
575 559
      *
576 560
      * @return void
577 561
      */
578
-    public function reset()
579
-    {
562
+    public function reset() {
580 563
         $this->elements = [];
581 564
         $this->records = [];
582 565
         $this->metadata = [];
@@ -592,8 +575,7 @@  discard block
 block discarded – undo
592 575
      *
593 576
      * @return void
594 577
      */
595
-    public function rewind()
596
-    {
578
+    public function rewind() {
597 579
         $this->position = 0;
598 580
     }
599 581
 
@@ -606,8 +588,7 @@  discard block
 block discarded – undo
606 588
      *
607 589
      * @return void
608 590
      */
609
-    public function save($pid = 0)
610
-    {
591
+    public function save($pid = 0) {
611 592
         $pid = max(intval($pid), 0);
612 593
         // If no PID is given, save to the user's session instead
613 594
         if ($pid > 0) {
@@ -624,8 +605,7 @@  discard block
 block discarded – undo
624 605
      *
625 606
      * @return bool true on success or false on failure
626 607
      */
627
-    protected function solrConnect()
628
-    {
608
+    protected function solrConnect() {
629 609
         // Get Solr instance.
630 610
         if (!$this->solr) {
631 611
             // Connect to Solr server.
@@ -674,8 +654,7 @@  discard block
 block discarded – undo
674 654
      *
675 655
      * @return void
676 656
      */
677
-    public function sort($by, $asc = true)
678
-    {
657
+    public function sort($by, $asc = true) {
679 658
         $newOrder = [];
680 659
         $nonSortable = [];
681 660
         foreach ($this->elements as $num => $element) {
@@ -712,8 +691,7 @@  discard block
 block discarded – undo
712 691
      *
713 692
      * @return void
714 693
      */
715
-    public function offsetUnset($offset)
716
-    {
694
+    public function offsetUnset($offset) {
717 695
         unset($this->elements[$offset]);
718 696
         // Re-number the elements.
719 697
         $this->elements = array_values($this->elements);
@@ -728,8 +706,7 @@  discard block
 block discarded – undo
728 706
      *
729 707
      * @return bool Is the current list position valid?
730 708
      */
731
-    public function valid()
732
-    {
709
+    public function valid() {
733 710
         return isset($this->elements[$this->position]);
734 711
     }
735 712
 
@@ -740,8 +717,7 @@  discard block
 block discarded – undo
740 717
      *
741 718
      * @return array The list's metadata
742 719
      */
743
-    protected function _getMetadata()
744
-    {
720
+    protected function _getMetadata() {
745 721
         return $this->metadata;
746 722
     }
747 723
 
@@ -754,8 +730,7 @@  discard block
 block discarded – undo
754 730
      *
755 731
      * @return void
756 732
      */
757
-    protected function _setMetadata(array $metadata = [])
758
-    {
733
+    protected function _setMetadata(array $metadata = []) {
759 734
         $this->metadata = $metadata;
760 735
     }
761 736
 
@@ -769,8 +744,7 @@  discard block
 block discarded – undo
769 744
      *
770 745
      * @return void
771 746
      */
772
-    public function __construct(array $elements = [], array $metadata = [])
773
-    {
747
+    public function __construct(array $elements = [], array $metadata = []) {
774 748
         if (
775 749
             empty($elements)
776 750
             && empty($metadata)
@@ -803,8 +777,7 @@  discard block
 block discarded – undo
803 777
      *
804 778
      * @return void
805 779
      */
806
-    protected function __clone()
807
-    {
780
+    protected function __clone() {
808 781
         // This method is defined as protected because singleton objects should not be cloned.
809 782
     }
810 783
 
@@ -817,8 +790,7 @@  discard block
 block discarded – undo
817 790
      *
818 791
      * @return mixed Value of $this->$var
819 792
      */
820
-    public function __get($var)
821
-    {
793
+    public function __get($var) {
822 794
         $method = '_get' . ucfirst($var);
823 795
         if (
824 796
             !property_exists($this, $var)
@@ -840,8 +812,7 @@  discard block
 block discarded – undo
840 812
      *
841 813
      * @return bool true if variable is set and not empty, false otherwise
842 814
      */
843
-    public function __isset($var)
844
-    {
815
+    public function __isset($var) {
845 816
         return !empty($this->__get($var));
846 817
     }
847 818
 
@@ -855,8 +826,7 @@  discard block
 block discarded – undo
855 826
      *
856 827
      * @return void
857 828
      */
858
-    public function __set($var, $value)
859
-    {
829
+    public function __set($var, $value) {
860 830
         $method = '_set' . ucfirst($var);
861 831
         if (
862 832
             !property_exists($this, $var)
@@ -876,8 +846,7 @@  discard block
 block discarded – undo
876 846
      *
877 847
      * @return array Properties to be serialized
878 848
      */
879
-    public function __sleep()
880
-    {
849
+    public function __sleep() {
881 850
         return ['elements', 'metadata'];
882 851
     }
883 852
 
@@ -889,8 +858,7 @@  discard block
 block discarded – undo
889 858
      *
890 859
      * @return void
891 860
      */
892
-    public function __wakeup()
893
-    {
861
+    public function __wakeup() {
894 862
         $this->count = count($this->elements);
895 863
     }
896 864
 }
Please login to merge, or discard this patch.
Classes/Common/IiifManifest.php 1 patch
Braces   +28 added lines, -56 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
  * @property-read string $toplevelId This holds the toplevel manifest's @id
57 57
  * @property-read mixed $uid This holds the UID or the URL of the document
58 58
  */
59
-final class IiifManifest extends Document
60
-{
59
+final class IiifManifest extends Document {
61 60
     /**
62 61
      * This holds the manifest file as string for serialization purposes
63 62
      * @see __sleep() / __wakeup()
@@ -118,8 +117,7 @@  discard block
 block discarded – undo
118 117
      * {@inheritDoc}
119 118
      * @see Document::establishRecordId()
120 119
      */
121
-    protected function establishRecordId($pid)
122
-    {
120
+    protected function establishRecordId($pid) {
123 121
         if ($this->iiif !== null) {
124 122
             /*
125 123
              *  FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss
@@ -170,8 +168,7 @@  discard block
 block discarded – undo
170 168
      * {@inheritDoc}
171 169
      * @see Document::getDocument()
172 170
      */
173
-    protected function getDocument()
174
-    {
171
+    protected function getDocument() {
175 172
         return $this->iiif;
176 173
     }
177 174
 
@@ -184,8 +181,7 @@  discard block
 block discarded – undo
184 181
      * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if
185 182
      * the resource is a Presentation API 2 / 3 resource
186 183
      */
187
-    public function getIiifVersion()
188
-    {
184
+    public function getIiifVersion() {
189 185
         if (!isset($this->iiifVersion)) {
190 186
             if ($this->iiif instanceof AbstractIiifResource1) {
191 187
                 $this->iiifVersion = 'IIIF1';
@@ -226,8 +222,7 @@  discard block
 block discarded – undo
226 222
      *
227 223
      * @return array|string
228 224
      */
229
-    protected function getUseGroups($use)
230
-    {
225
+    protected function getUseGroups($use) {
231 226
         if (!$this->useGrpsLoaded) {
232 227
             // Get configured USE attributes.
233 228
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -255,8 +250,7 @@  discard block
 block discarded – undo
255 250
      * {@inheritDoc}
256 251
      * @see Document::_getPhysicalStructure()
257 252
      */
258
-    protected function _getPhysicalStructure()
259
-    {
253
+    protected function _getPhysicalStructure() {
260 254
         // Is there no physical structure array yet?
261 255
         if (!$this->physicalStructureLoaded) {
262 256
             if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) {
@@ -369,8 +363,7 @@  discard block
 block discarded – undo
369 363
      * {@inheritDoc}
370 364
      * @see Document::getDownloadLocation()
371 365
      */
372
-    public function getDownloadLocation($id)
373
-    {
366
+    public function getDownloadLocation($id) {
374 367
         $fileLocation = $this->getFileLocation($id);
375 368
         $resource = $this->iiif->getContainedResourceById($fileLocation);
376 369
         if ($resource instanceof AbstractImageService) {
@@ -383,8 +376,7 @@  discard block
 block discarded – undo
383 376
      * {@inheritDoc}
384 377
      * @see Document::getFileLocation()
385 378
      */
386
-    public function getFileLocation($id)
387
-    {
379
+    public function getFileLocation($id) {
388 380
         if ($id == null) {
389 381
             return null;
390 382
         }
@@ -408,8 +400,7 @@  discard block
 block discarded – undo
408 400
      * {@inheritDoc}
409 401
      * @see Document::getFileMimeType()
410 402
      */
411
-    public function getFileMimeType($id)
412
-    {
403
+    public function getFileMimeType($id) {
413 404
         $fileResource = $this->iiif->getContainedResourceById($id);
414 405
         if ($fileResource instanceof CanvasInterface) {
415 406
             $format = "application/vnd.kitodo.iiif";
@@ -434,8 +425,7 @@  discard block
 block discarded – undo
434 425
      * {@inheritDoc}
435 426
      * @see Document::getLogicalStructure()
436 427
      */
437
-    public function getLogicalStructure($id, $recursive = false)
438
-    {
428
+    public function getLogicalStructure($id, $recursive = false) {
439 429
         $details = [];
440 430
         if (!$recursive && !empty($this->logicalUnits[$id])) {
441 431
             return $this->logicalUnits[$id];
@@ -470,8 +460,7 @@  discard block
 block discarded – undo
470 460
      * @param array $processedStructures: IIIF resources that already have been processed
471 461
      * @return array Logical structure array
472 462
      */
473
-    protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = [])
474
-    {
463
+    protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) {
475 464
         $details = [];
476 465
         $details['id'] = $resource->getId();
477 466
         $details['dmdId'] = '';
@@ -563,8 +552,7 @@  discard block
 block discarded – undo
563 552
      *
564 553
      * @todo This method is still in experimental; the method signature may change.
565 554
      */
566
-    public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true)
567
-    {
555
+    public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) {
568 556
         if (!empty($this->originalMetadataArray[$id])) {
569 557
             return $this->originalMetadataArray[$id];
570 558
         }
@@ -606,8 +594,7 @@  discard block
 block discarded – undo
606 594
      * {@inheritDoc}
607 595
      * @see Document::getMetadata()
608 596
      */
609
-    public function getMetadata($id, $cPid = 0)
610
-    {
597
+    public function getMetadata($id, $cPid = 0) {
611 598
         if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) {
612 599
             return $this->metadataArray[$id];
613 600
         }
@@ -714,8 +701,7 @@  discard block
 block discarded – undo
714 701
      * {@inheritDoc}
715 702
      * @see Document::_getSmLinks()
716 703
      */
717
-    protected function _getSmLinks()
718
-    {
704
+    protected function _getSmLinks() {
719 705
         if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) {
720 706
             if (!empty($this->iiif->getDefaultCanvases())) {
721 707
                 foreach ($this->iiif->getDefaultCanvases() as $canvas) {
@@ -739,8 +725,7 @@  discard block
 block discarded – undo
739 725
      *
740 726
      * @param RangeInterface $range: Current range whose canvases shall be linked
741 727
      */
742
-    private function smLinkRangeCanvasesRecursively(RangeInterface $range)
743
-    {
728
+    private function smLinkRangeCanvasesRecursively(RangeInterface $range) {
744 729
         // map range's canvases including all child ranges' canvases
745 730
         if (!$range->isTopRange()) {
746 731
             foreach ($range->getAllCanvasesRecursively() as $canvas) {
@@ -763,8 +748,7 @@  discard block
 block discarded – undo
763 748
      * @param CanvasInterface $canvas
764 749
      * @param IiifResourceInterface $resource
765 750
      */
766
-    private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource)
767
-    {
751
+    private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) {
768 752
         $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId();
769 753
         if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) {
770 754
             $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId();
@@ -779,8 +763,7 @@  discard block
 block discarded – undo
779 763
      *
780 764
      * @see Document::getParentDocumentUidForSaving()
781 765
      */
782
-    protected function getParentDocumentUidForSaving($pid, $core, $owner)
783
-    {
766
+    protected function getParentDocumentUidForSaving($pid, $core, $owner) {
784 767
         // Do nothing.
785 768
     }
786 769
 
@@ -789,8 +772,7 @@  discard block
 block discarded – undo
789 772
      * @see Document::getFullText()
790 773
      */
791 774
     //TODO: rewrite it to get full OCR
792
-    public function getFullText($id)
793
-    {
775
+    public function getFullText($id) {
794 776
         $rawText = '';
795 777
         // Get text from raw text array if available.
796 778
         if (!empty($this->rawTextArray[$id])) {
@@ -847,8 +829,7 @@  discard block
 block discarded – undo
847 829
      *
848 830
      * @return IiifResourceInterface
849 831
      */
850
-    public function getIiif()
851
-    {
832
+    public function getIiif() {
852 833
         return $this->iiif;
853 834
     }
854 835
 
@@ -856,8 +837,7 @@  discard block
 block discarded – undo
856 837
      * {@inheritDoc}
857 838
      * @see Document::init()
858 839
      */
859
-    protected function init()
860
-    {
840
+    protected function init() {
861 841
         // Nothing to do here, at the moment
862 842
     }
863 843
 
@@ -865,8 +845,7 @@  discard block
 block discarded – undo
865 845
      * {@inheritDoc}
866 846
      * @see Document::loadLocation()
867 847
      */
868
-    protected function loadLocation($location)
869
-    {
848
+    protected function loadLocation($location) {
870 849
         $fileResource = GeneralUtility::getUrl($location);
871 850
         if ($fileResource !== false) {
872 851
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -889,8 +868,7 @@  discard block
 block discarded – undo
889 868
      * {@inheritDoc}
890 869
      * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray()
891 870
      */
892
-    protected function prepareMetadataArray($cPid)
893
-    {
871
+    protected function prepareMetadataArray($cPid) {
894 872
         $id = $this->iiif->getId();
895 873
         $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid);
896 874
     }
@@ -899,8 +877,7 @@  discard block
 block discarded – undo
899 877
      * {@inheritDoc}
900 878
      * @see Document::setPreloadedDocument()
901 879
      */
902
-    protected function setPreloadedDocument($preloadedDocument)
903
-    {
880
+    protected function setPreloadedDocument($preloadedDocument) {
904 881
         if ($preloadedDocument instanceof ManifestInterface) {
905 882
             $this->iiif = $preloadedDocument;
906 883
             return true;
@@ -912,8 +889,7 @@  discard block
 block discarded – undo
912 889
      * {@inheritDoc}
913 890
      * @see Document::ensureHasFulltextIsSet()
914 891
      */
915
-    protected function ensureHasFulltextIsSet()
916
-    {
892
+    protected function ensureHasFulltextIsSet() {
917 893
         /*
918 894
          *  TODO Check annotations and annotation lists of canvas for ALTO documents.
919 895
          *  Example:
@@ -959,8 +935,7 @@  discard block
 block discarded – undo
959 935
      * {@inheritDoc}
960 936
      * @see \Kitodo\Dlf\Common\Document::_getThumbnail()
961 937
      */
962
-    protected function _getThumbnail($forceReload = false)
963
-    {
938
+    protected function _getThumbnail($forceReload = false) {
964 939
         return $this->iiif->getThumbnailUrl();
965 940
     }
966 941
 
@@ -968,8 +943,7 @@  discard block
 block discarded – undo
968 943
      * {@inheritDoc}
969 944
      * @see \Kitodo\Dlf\Common\Document::_getToplevelId()
970 945
      */
971
-    protected function _getToplevelId()
972
-    {
946
+    protected function _getToplevelId() {
973 947
         if (empty($this->toplevelId)) {
974 948
             if (isset($this->iiif)) {
975 949
                 $this->toplevelId = $this->iiif->getId();
@@ -986,8 +960,7 @@  discard block
 block discarded – undo
986 960
      *
987 961
      * @return void
988 962
      */
989
-    public function __wakeup()
990
-    {
963
+    public function __wakeup() {
991 964
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
992 965
         IiifHelper::setUrlReader(IiifUrlReader::getInstance());
993 966
         IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
@@ -1006,8 +979,7 @@  discard block
 block discarded – undo
1006 979
      *
1007 980
      * @return string[]
1008 981
      */
1009
-    public function __sleep()
1010
-    {
982
+    public function __sleep() {
1011 983
         // TODO implement serializiation in IIIF library
1012 984
         $jsonArray = $this->iiif->getOriginalJsonArray();
1013 985
         $this->asJson = json_encode($jsonArray);
Please login to merge, or discard this patch.
Classes/Common/SolrSearchResult/ResultDocument.php 1 patch
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
  * @subpackage dlf
25 25
  * @access public
26 26
  */
27
-class ResultDocument
28
-{
27
+class ResultDocument {
29 28
 
30 29
     /**
31 30
      * The identifier
@@ -102,8 +101,7 @@  discard block
 block discarded – undo
102 101
      *
103 102
      * @return void
104 103
      */
105
-    public function __construct($record, $highlighting, $fields)
106
-    {
104
+    public function __construct($record, $highlighting, $fields) {
107 105
         $this->id = $record[$fields['id']];
108 106
         $this->uid = $record[$fields['uid']];
109 107
         $this->page = $record[$fields['page']];
@@ -124,8 +122,7 @@  discard block
 block discarded – undo
124 122
      *
125 123
      * @return string The result's record identifier
126 124
      */
127
-    public function getId()
128
-    {
125
+    public function getId() {
129 126
         return $this->id;
130 127
     }
131 128
 
@@ -136,8 +133,7 @@  discard block
 block discarded – undo
136 133
      *
137 134
      * @return string|null The result's record unified identifier
138 135
      */
139
-    public function getUid()
140
-    {
136
+    public function getUid() {
141 137
         return $this->uid;
142 138
     }
143 139
 
@@ -148,8 +144,7 @@  discard block
 block discarded – undo
148 144
      *
149 145
      * @return int The result's record page
150 146
      */
151
-    public function getPage()
152
-    {
147
+    public function getPage() {
153 148
         return $this->page;
154 149
     }
155 150
 
@@ -160,8 +155,7 @@  discard block
 block discarded – undo
160 155
      *
161 156
      * @return string All result's record snippets imploded to one string
162 157
      */
163
-    public function getSnippets()
164
-    {
158
+    public function getSnippets() {
165 159
         return $this->snippets;
166 160
     }
167 161
 
@@ -172,8 +166,7 @@  discard block
 block discarded – undo
172 166
      *
173 167
      * @return array(Page) All result's pages which contain search phrase
174 168
      */
175
-    public function getPages()
176
-    {
169
+    public function getPages() {
177 170
         return $this->pages;
178 171
     }
179 172
 
@@ -184,8 +177,7 @@  discard block
 block discarded – undo
184 177
      *
185 178
      * @return array(Region) All result's regions which contain search phrase
186 179
      */
187
-    public function getRegions()
188
-    {
180
+    public function getRegions() {
189 181
         return $this->regions;
190 182
     }
191 183
 
@@ -196,8 +188,7 @@  discard block
 block discarded – undo
196 188
      *
197 189
      * @return array(Highlight) All result's highlights of search phrase
198 190
      */
199
-    public function getHighlights()
200
-    {
191
+    public function getHighlights() {
201 192
         return $this->highlights;
202 193
     }
203 194
 
@@ -208,8 +199,7 @@  discard block
 block discarded – undo
208 199
      *
209 200
      * @return array(string) All result's highlights of search phrase
210 201
      */
211
-    public function getHighlightsIds()
212
-    {
202
+    public function getHighlightsIds() {
213 203
         $highlightsIds = [];
214 204
         foreach ($this->highlights as $highlight) {
215 205
             array_push($highlightsIds, $highlight->getId());
@@ -225,8 +215,7 @@  discard block
 block discarded – undo
225 215
      *
226 216
      * @return void
227 217
      */
228
-    private function parseSnippets()
229
-    {
218
+    private function parseSnippets() {
230 219
         $snippetArray = $this->getArrayByIndex('text');
231 220
 
232 221
         $this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : '';
@@ -240,8 +229,7 @@  discard block
 block discarded – undo
240 229
      *
241 230
      * @return void
242 231
      */
243
-    private function parsePages()
244
-    {
232
+    private function parsePages() {
245 233
         $pageArray = $this->getArrayByIndex('pages');
246 234
 
247 235
         $i = 0;
@@ -261,8 +249,7 @@  discard block
 block discarded – undo
261 249
      *
262 250
      * @return void
263 251
      */
264
-    private function parseRegions()
265
-    {
252
+    private function parseRegions() {
266 253
         $regionArray = $this->getArrayByIndex('regions');
267 254
 
268 255
         $i = 0;
@@ -282,8 +269,7 @@  discard block
 block discarded – undo
282 269
      *
283 270
      * @return void
284 271
      */
285
-    private function parseHighlights()
286
-    {
272
+    private function parseHighlights() {
287 273
         $highlightArray = $this->getArrayByIndex('highlights');
288 274
 
289 275
         foreach ($highlightArray as $highlights) {
@@ -304,8 +290,7 @@  discard block
 block discarded – undo
304 290
      *
305 291
      * @return array
306 292
      */
307
-    private function getArrayByIndex($index)
308
-    {
293
+    private function getArrayByIndex($index) {
309 294
         $objectArray = [];
310 295
         foreach ($this->snippetsForRecord as $snippet) {
311 296
             if (!empty($snippet[$index])) {
Please login to merge, or discard this patch.
Classes/Common/SolrSearchResult/Highlight.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @subpackage dlf
21 21
  * @access public
22 22
  */
23
-class Highlight
24
-{
23
+class Highlight {
25 24
 
26 25
     /**
27 26
      * The identifier in form 'w_h_x_y'
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
      *
81 80
      * @return void
82 81
      */
83
-    public function __construct($highlight)
84
-    {
82
+    public function __construct($highlight) {
85 83
         $this->parentRegionId = $highlight['parentRegionIdx'];
86 84
         $this->xBeginPosition = $highlight['ulx'];
87 85
         $this->xEndPosition = $highlight['lrx'];
@@ -97,8 +95,7 @@  discard block
 block discarded – undo
97 95
      *
98 96
      * @return string The highlight's identifier
99 97
      */
100
-    public function getId()
101
-    {
98
+    public function getId() {
102 99
         return $this->id;
103 100
     }
104 101
 
@@ -109,8 +106,7 @@  discard block
 block discarded – undo
109 106
      *
110 107
      * @return int The highlight's horizontal beginning position
111 108
      */
112
-    public function getXBeginPosition()
113
-    {
109
+    public function getXBeginPosition() {
114 110
         return $this->xBeginPosition;
115 111
     }
116 112
 
@@ -121,8 +117,7 @@  discard block
 block discarded – undo
121 117
      *
122 118
      * @return int The highlight's horizontal ending position
123 119
      */
124
-    public function getXEndPosition()
125
-    {
120
+    public function getXEndPosition() {
126 121
         return $this->xEndPosition;
127 122
     }
128 123
 
@@ -133,8 +128,7 @@  discard block
 block discarded – undo
133 128
      *
134 129
      * @return int The highlight's vertical beginning position
135 130
      */
136
-    public function getYBeginPosition()
137
-    {
131
+    public function getYBeginPosition() {
138 132
         return $this->yBeginPosition;
139 133
     }
140 134
 
@@ -145,8 +139,7 @@  discard block
 block discarded – undo
145 139
      *
146 140
      * @return int The highlight's vertical ending position
147 141
      */
148
-    public function getYEndPosition()
149
-    {
142
+    public function getYEndPosition() {
150 143
         return $this->yEndPosition;
151 144
     }
152 145
 }
Please login to merge, or discard this patch.
Classes/Common/MetsDocument.php 1 patch
Braces   +28 added lines, -56 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
  * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF)
49 49
  * @property-read mixed $uid This holds the UID or the URL of the document
50 50
  */
51
-final class MetsDocument extends Document
52
-{
51
+final class MetsDocument extends Document {
53 52
     /**
54 53
      * This holds the whole XML file as string for serialization purposes
55 54
      * @see __sleep() / __wakeup()
@@ -128,8 +127,7 @@  discard block
 block discarded – undo
128 127
      *
129 128
      * @return  void
130 129
      */
131
-    public function addMetadataFromMets(&$metadata, $id)
132
-    {
130
+    public function addMetadataFromMets(&$metadata, $id) {
133 131
         $details = $this->getLogicalStructure($id);
134 132
         if (!empty($details)) {
135 133
             $metadata['mets_order'][0] = $details['order'];
@@ -143,8 +141,7 @@  discard block
 block discarded – undo
143 141
      * {@inheritDoc}
144 142
      * @see \Kitodo\Dlf\Common\Document::establishRecordId()
145 143
      */
146
-    protected function establishRecordId($pid)
147
-    {
144
+    protected function establishRecordId($pid) {
148 145
         // Check for METS object @ID.
149 146
         if (!empty($this->mets['OBJID'])) {
150 147
             $this->recordId = (string) $this->mets['OBJID'];
@@ -164,8 +161,7 @@  discard block
 block discarded – undo
164 161
      * {@inheritDoc}
165 162
      * @see \Kitodo\Dlf\Common\Document::getDownloadLocation()
166 163
      */
167
-    public function getDownloadLocation($id)
168
-    {
164
+    public function getDownloadLocation($id) {
169 165
         $fileMimeType = $this->getFileMimeType($id);
170 166
         $fileLocation = $this->getFileLocation($id);
171 167
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
@@ -190,8 +186,7 @@  discard block
 block discarded – undo
190 186
      * {@inheritDoc}
191 187
      * @see \Kitodo\Dlf\Common\Document::getFileLocation()
192 188
      */
193
-    public function getFileLocation($id)
194
-    {
189
+    public function getFileLocation($id) {
195 190
         $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
196 191
         if (
197 192
             !empty($id)
@@ -208,8 +203,7 @@  discard block
 block discarded – undo
208 203
      * {@inheritDoc}
209 204
      * @see \Kitodo\Dlf\Common\Document::getFileMimeType()
210 205
      */
211
-    public function getFileMimeType($id)
212
-    {
206
+    public function getFileMimeType($id) {
213 207
         $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
214 208
         if (
215 209
             !empty($id)
@@ -226,8 +220,7 @@  discard block
 block discarded – undo
226 220
      * {@inheritDoc}
227 221
      * @see \Kitodo\Dlf\Common\Document::getLogicalStructure()
228 222
      */
229
-    public function getLogicalStructure($id, $recursive = false)
230
-    {
223
+    public function getLogicalStructure($id, $recursive = false) {
231 224
         $details = [];
232 225
         // Is the requested logical unit already loaded?
233 226
         if (
@@ -267,8 +260,7 @@  discard block
 block discarded – undo
267 260
      *
268 261
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
269 262
      */
270
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
271
-    {
263
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) {
272 264
         // Get attributes.
273 265
         foreach ($structure->attributes() as $attribute => $value) {
274 266
             $attributes[$attribute] = (string) $value;
@@ -366,8 +358,7 @@  discard block
 block discarded – undo
366 358
      * {@inheritDoc}
367 359
      * @see \Kitodo\Dlf\Common\Document::getMetadata()
368 360
      */
369
-    public function getMetadata($id, $cPid = 0)
370
-    {
361
+    public function getMetadata($id, $cPid = 0) {
371 362
         // Make sure $cPid is a non-negative integer.
372 363
         $cPid = max(intval($cPid), 0);
373 364
         // If $cPid is not given, try to get it elsewhere.
@@ -669,8 +660,7 @@  discard block
 block discarded – undo
669 660
      * {@inheritDoc}
670 661
      * @see \Kitodo\Dlf\Common\Document::getFullText()
671 662
      */
672
-    public function getFullText($id)
673
-    {
663
+    public function getFullText($id) {
674 664
         $fullText = '';
675 665
 
676 666
         // Load fileGrps and check for full text files.
@@ -685,8 +675,7 @@  discard block
 block discarded – undo
685 675
      * {@inheritDoc}
686 676
      * @see Document::getStructureDepth()
687 677
      */
688
-    public function getStructureDepth($logId)
689
-    {
678
+    public function getStructureDepth($logId) {
690 679
         $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
691 680
         if (!empty($ancestors)) {
692 681
             return count($ancestors);
@@ -699,8 +688,7 @@  discard block
 block discarded – undo
699 688
      * {@inheritDoc}
700 689
      * @see \Kitodo\Dlf\Common\Document::init()
701 690
      */
702
-    protected function init()
703
-    {
691
+    protected function init() {
704 692
         // Get METS node from XML file.
705 693
         $this->registerNamespaces($this->xml);
706 694
         $mets = $this->xml->xpath('//mets:mets');
@@ -717,8 +705,7 @@  discard block
 block discarded – undo
717 705
      * {@inheritDoc}
718 706
      * @see \Kitodo\Dlf\Common\Document::loadLocation()
719 707
      */
720
-    protected function loadLocation($location)
721
-    {
708
+    protected function loadLocation($location) {
722 709
         $fileResource = GeneralUtility::getUrl($location);
723 710
         if ($fileResource !== false) {
724 711
             // Turn off libxml's error logging.
@@ -745,8 +732,7 @@  discard block
 block discarded – undo
745 732
      * {@inheritDoc}
746 733
      * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet()
747 734
      */
748
-    protected function ensureHasFulltextIsSet()
749
-    {
735
+    protected function ensureHasFulltextIsSet() {
750 736
         // Are the fileGrps already loaded?
751 737
         if (!$this->fileGrpsLoaded) {
752 738
             $this->_getFileGrps();
@@ -757,8 +743,7 @@  discard block
 block discarded – undo
757 743
      * {@inheritDoc}
758 744
      * @see Document::getParentDocumentUid()
759 745
      */
760
-    protected function getParentDocumentUidForSaving($pid, $core, $owner)
761
-    {
746
+    protected function getParentDocumentUidForSaving($pid, $core, $owner) {
762 747
         $partof = 0;
763 748
         // Get the closest ancestor of the current document which has a MPTR child.
764 749
         $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
@@ -781,8 +766,7 @@  discard block
 block discarded – undo
781 766
      * {@inheritDoc}
782 767
      * @see Document::setPreloadedDocument()
783 768
      */
784
-    protected function setPreloadedDocument($preloadedDocument)
785
-    {
769
+    protected function setPreloadedDocument($preloadedDocument) {
786 770
 
787 771
         if ($preloadedDocument instanceof \SimpleXMLElement) {
788 772
             $this->xml = $preloadedDocument;
@@ -795,8 +779,7 @@  discard block
 block discarded – undo
795 779
      * {@inheritDoc}
796 780
      * @see Document::getDocument()
797 781
      */
798
-    protected function getDocument()
799
-    {
782
+    protected function getDocument() {
800 783
         return $this->mets;
801 784
     }
802 785
 
@@ -807,8 +790,7 @@  discard block
 block discarded – undo
807 790
      *
808 791
      * @return array Array of dmdSecs with their IDs as array key
809 792
      */
810
-    protected function _getDmdSec()
811
-    {
793
+    protected function _getDmdSec() {
812 794
         if (!$this->dmdSecLoaded) {
813 795
             // Get available data formats.
814 796
             $this->loadFormats();
@@ -846,8 +828,7 @@  discard block
 block discarded – undo
846 828
      *
847 829
      * @return array Array of file use groups with file IDs
848 830
      */
849
-    protected function _getFileGrps()
850
-    {
831
+    protected function _getFileGrps() {
851 832
         if (!$this->fileGrpsLoaded) {
852 833
             // Get configured USE attributes.
853 834
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -892,8 +873,7 @@  discard block
 block discarded – undo
892 873
      * {@inheritDoc}
893 874
      * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray()
894 875
      */
895
-    protected function prepareMetadataArray($cPid)
896
-    {
876
+    protected function prepareMetadataArray($cPid) {
897 877
         $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID');
898 878
         // Get all logical structure nodes with metadata.
899 879
         if (!empty($ids)) {
@@ -911,8 +891,7 @@  discard block
 block discarded – undo
911 891
      *
912 892
      * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object
913 893
      */
914
-    protected function _getMets()
915
-    {
894
+    protected function _getMets() {
916 895
         return $this->mets;
917 896
     }
918 897
 
@@ -920,8 +899,7 @@  discard block
 block discarded – undo
920 899
      * {@inheritDoc}
921 900
      * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure()
922 901
      */
923
-    protected function _getPhysicalStructure()
924
-    {
902
+    protected function _getPhysicalStructure() {
925 903
         // Is there no physical structure array yet?
926 904
         if (!$this->physicalStructureLoaded) {
927 905
             // Does the document have a structMap node of type "PHYSICAL"?
@@ -981,8 +959,7 @@  discard block
 block discarded – undo
981 959
      * {@inheritDoc}
982 960
      * @see \Kitodo\Dlf\Common\Document::_getSmLinks()
983 961
      */
984
-    protected function _getSmLinks()
985
-    {
962
+    protected function _getSmLinks() {
986 963
         if (!$this->smLinksLoaded) {
987 964
             $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
988 965
             if (!empty($smLinks)) {
@@ -1000,8 +977,7 @@  discard block
 block discarded – undo
1000 977
      * {@inheritDoc}
1001 978
      * @see \Kitodo\Dlf\Common\Document::_getThumbnail()
1002 979
      */
1003
-    protected function _getThumbnail($forceReload = false)
1004
-    {
980
+    protected function _getThumbnail($forceReload = false) {
1005 981
         if (
1006 982
             !$this->thumbnailLoaded
1007 983
             || $forceReload
@@ -1080,8 +1056,7 @@  discard block
 block discarded – undo
1080 1056
      * {@inheritDoc}
1081 1057
      * @see \Kitodo\Dlf\Common\Document::_getToplevelId()
1082 1058
      */
1083
-    protected function _getToplevelId()
1084
-    {
1059
+    protected function _getToplevelId() {
1085 1060
         if (empty($this->toplevelId)) {
1086 1061
             // Get all logical structure nodes with metadata, but without associated METS-Pointers.
1087 1062
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]');
@@ -1113,8 +1088,7 @@  discard block
 block discarded – undo
1113 1088
      *
1114 1089
      * @return array Properties to be serialized
1115 1090
      */
1116
-    public function __sleep()
1117
-    {
1091
+    public function __sleep() {
1118 1092
         // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
1119 1093
         $this->asXML = $this->xml->asXML();
1120 1094
         return ['uid', 'pid', 'recordId', 'parentId', 'asXML'];
@@ -1127,8 +1101,7 @@  discard block
 block discarded – undo
1127 1101
      *
1128 1102
      * @return string String representing the METS object
1129 1103
      */
1130
-    public function __toString()
1131
-    {
1104
+    public function __toString() {
1132 1105
         $xml = new \DOMDocument('1.0', 'utf-8');
1133 1106
         $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1134 1107
         $xml->formatOutput = true;
@@ -1143,8 +1116,7 @@  discard block
 block discarded – undo
1143 1116
      *
1144 1117
      * @return void
1145 1118
      */
1146
-    public function __wakeup()
1147
-    {
1119
+    public function __wakeup() {
1148 1120
         // Turn off libxml's error logging.
1149 1121
         $libxmlErrors = libxml_use_internal_errors(true);
1150 1122
         // Reload XML from string.
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
  * @subpackage dlf
30 30
  * @access public
31 31
  */
32
-class Indexer
33
-{
32
+class Indexer {
34 33
     /**
35 34
      * The extension key
36 35
      *
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
      *
92 91
      * @return bool true on success or false on failure
93 92
      */
94
-    public static function add(Document &$doc, $core = 0)
95
-    {
93
+    public static function add(Document &$doc, $core = 0) {
96 94
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
97 95
 
98 96
         if (in_array($doc->uid, self::$processedDocs)) {
@@ -214,8 +212,7 @@  discard block
 block discarded – undo
214 212
      *
215 213
      * @return string The field's dynamic index name
216 214
      */
217
-    public static function getIndexFieldName($index_name, $pid = 0)
218
-    {
215
+    public static function getIndexFieldName($index_name, $pid = 0) {
219 216
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
220 217
 
221 218
         // Sanitize input.
@@ -243,8 +240,7 @@  discard block
 block discarded – undo
243 240
      *
244 241
      * @return void
245 242
      */
246
-    protected static function loadIndexConf($pid)
247
-    {
243
+    protected static function loadIndexConf($pid) {
248 244
         if (!self::$fieldsLoaded) {
249 245
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
250 246
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -314,8 +310,7 @@  discard block
 block discarded – undo
314 310
      *
315 311
      * @return bool true on success or false on failure
316 312
      */
317
-    protected static function processLogical(Document &$doc, array $logicalUnit)
318
-    {
313
+    protected static function processLogical(Document &$doc, array $logicalUnit) {
319 314
         $logger = GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
320 315
 
321 316
         $success = true;
@@ -446,8 +441,7 @@  discard block
 block discarded – undo
446 441
      *
447 442
      * @return bool true on success or false on failure
448 443
      */
449
-    protected static function processPhysical(Document &$doc, $page, array $physicalUnit)
450
-    {
444
+    protected static function processPhysical(Document &$doc, $page, array $physicalUnit) {
451 445
         $logger = GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
452 446
 
453 447
         if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) {
@@ -533,8 +527,7 @@  discard block
 block discarded – undo
533 527
      *
534 528
      * @return bool true on success or false on failure
535 529
      */
536
-    protected static function solrConnect($core, $pid = 0)
537
-    {
530
+    protected static function solrConnect($core, $pid = 0) {
538 531
         // Get Solr instance.
539 532
         if (!self::$solr) {
540 533
             // Connect to Solr server.
@@ -557,8 +550,7 @@  discard block
 block discarded – undo
557 550
      *
558 551
      * @access private
559 552
      */
560
-    private function __construct()
561
-    {
553
+    private function __construct() {
562 554
         // This is a static class, thus no instances should be created.
563 555
     }
564 556
 }
Please login to merge, or discard this patch.