Passed
Pull Request — master (#105)
by Alexander
05:13
created
Classes/Common/Solr.php 1 patch
Braces   +21 added lines, -42 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
  * @property-read bool $ready Is the Solr service instantiated successfully?
38 38
  * @property-read \Solarium\Client $service This holds the Solr service object
39 39
  */
40
-class Solr implements LoggerAwareInterface
41
-{
40
+class Solr implements LoggerAwareInterface {
42 41
     use LoggerAwareTrait;
43 42
 
44 43
     /**
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
      *
131 130
      * @return string The name of the new core
132 131
      */
133
-    public static function createCore($core = '')
134
-    {
132
+    public static function createCore($core = '') {
135 133
         // Get next available core name if none given.
136 134
         if (empty($core)) {
137 135
             $core = 'dlfCore' . self::getNextCoreNumber();
@@ -178,8 +176,7 @@  discard block
 block discarded – undo
178 176
      *
179 177
      * @return string The escaped query string
180 178
      */
181
-    public static function escapeQuery($query)
182
-    {
179
+    public static function escapeQuery($query) {
183 180
         $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class);
184 181
         // Escape query phrase or term.
185 182
         if (preg_match('/^".*"$/', $query)) {
@@ -202,8 +199,7 @@  discard block
 block discarded – undo
202 199
      *
203 200
      * @return string The escaped query string
204 201
      */
205
-    public static function escapeQueryKeepField($query, $pid)
206
-    {
202
+    public static function escapeQueryKeepField($query, $pid) {
207 203
         // Is there a field query?
208 204
         if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) {
209 205
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -253,8 +249,7 @@  discard block
 block discarded – undo
253 249
      *
254 250
      * @return array fields
255 251
      */
256
-    public static function getFields()
257
-    {
252
+    public static function getFields() {
258 253
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
259 254
 
260 255
         $fields = [];
@@ -296,8 +291,7 @@  discard block
 block discarded – undo
296 291
      *
297 292
      * @return \Kitodo\Dlf\Common\Solr Instance of this class
298 293
      */
299
-    public static function getInstance($core = null)
300
-    {
294
+    public static function getInstance($core = null) {
301 295
         // Get core name if UID is given.
302 296
         if (MathUtility::canBeInterpretedAsInteger($core)) {
303 297
             $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores');
@@ -337,8 +331,7 @@  discard block
 block discarded – undo
337 331
      *
338 332
      * @return int First unused core number found
339 333
      */
340
-    public static function getNextCoreNumber($number = 0)
341
-    {
334
+    public static function getNextCoreNumber($number = 0) {
342 335
         $number = max(intval($number), 0);
343 336
         // Check if core already exists.
344 337
         $solr = self::getInstance('dlfCore' . $number);
@@ -356,8 +349,7 @@  discard block
 block discarded – undo
356 349
      *
357 350
      * @return void
358 351
      */
359
-    protected function loadSolrConnectionInfo()
360
-    {
352
+    protected function loadSolrConnectionInfo() {
361 353
         if (empty($this->config)) {
362 354
             $config = [];
363 355
             // Extract extension configuration.
@@ -397,8 +389,7 @@  discard block
 block discarded – undo
397 389
      *
398 390
      * @return array The Apache Solr Documents that were fetched
399 391
      */
400
-    public function search_raw($parameters = [])
401
-    {
392
+    public function search_raw($parameters = []) {
402 393
         // Set additional query parameters.
403 394
         $parameters['start'] = 0;
404 395
         $parameters['rows'] = $this->limit;
@@ -428,8 +419,7 @@  discard block
 block discarded – undo
428 419
      *
429 420
      * @return string|null The core name of the current query endpoint or null if core admin endpoint
430 421
      */
431
-    protected function _getCore()
432
-    {
422
+    protected function _getCore() {
433 423
         return $this->core;
434 424
     }
435 425
 
@@ -440,8 +430,7 @@  discard block
 block discarded – undo
440 430
      *
441 431
      * @return int The max number of results
442 432
      */
443
-    protected function _getLimit()
444
-    {
433
+    protected function _getLimit() {
445 434
         return $this->limit;
446 435
     }
447 436
 
@@ -452,8 +441,7 @@  discard block
 block discarded – undo
452 441
      *
453 442
      * @return int Total number of hits for last search
454 443
      */
455
-    protected function _getNumberOfHits()
456
-    {
444
+    protected function _getNumberOfHits() {
457 445
         return $this->numberOfHits;
458 446
     }
459 447
 
@@ -464,8 +452,7 @@  discard block
 block discarded – undo
464 452
      *
465 453
      * @return bool Is the search instantiated successfully?
466 454
      */
467
-    protected function _getReady()
468
-    {
455
+    protected function _getReady() {
469 456
         return $this->ready;
470 457
     }
471 458
 
@@ -476,8 +463,7 @@  discard block
 block discarded – undo
476 463
      *
477 464
      * @return \Solarium\Client Apache Solr service object
478 465
      */
479
-    protected function _getService()
480
-    {
466
+    protected function _getService() {
481 467
         return $this->service;
482 468
     }
483 469
 
@@ -490,8 +476,7 @@  discard block
 block discarded – undo
490 476
      *
491 477
      * @return void
492 478
      */
493
-    protected function _setCPid($value)
494
-    {
479
+    protected function _setCPid($value) {
495 480
         $this->cPid = max(intval($value), 0);
496 481
     }
497 482
 
@@ -504,8 +489,7 @@  discard block
 block discarded – undo
504 489
      *
505 490
      * @return void
506 491
      */
507
-    protected function _setLimit($value)
508
-    {
492
+    protected function _setLimit($value) {
509 493
         $this->limit = max(intval($value), 0);
510 494
     }
511 495
 
@@ -518,8 +502,7 @@  discard block
 block discarded – undo
518 502
      *
519 503
      * @return void
520 504
      */
521
-    protected function _setParams(array $value)
522
-    {
505
+    protected function _setParams(array $value) {
523 506
         $this->params = $value;
524 507
     }
525 508
 
@@ -532,8 +515,7 @@  discard block
 block discarded – undo
532 515
      *
533 516
      * @return mixed Value of $this->$var
534 517
      */
535
-    public function __get($var)
536
-    {
518
+    public function __get($var) {
537 519
         $method = '_get' . ucfirst($var);
538 520
         if (
539 521
             !property_exists($this, $var)
@@ -555,8 +537,7 @@  discard block
 block discarded – undo
555 537
      *
556 538
      * @return bool true if variable is set and not empty, false otherwise
557 539
      */
558
-    public function __isset($var)
559
-    {
540
+    public function __isset($var) {
560 541
         return !empty($this->__get($var));
561 542
     }
562 543
 
@@ -570,8 +551,7 @@  discard block
 block discarded – undo
570 551
      *
571 552
      * @return void
572 553
      */
573
-    public function __set($var, $value)
574
-    {
554
+    public function __set($var, $value) {
575 555
         $method = '_set' . ucfirst($var);
576 556
         if (
577 557
             !property_exists($this, $var)
@@ -592,8 +572,7 @@  discard block
 block discarded – undo
592 572
      *
593 573
      * @return void
594 574
      */
595
-    protected function __construct($core)
596
-    {
575
+    protected function __construct($core) {
597 576
         // Get Solr connection parameters from configuration.
598 577
         $this->loadSolrConnectionInfo();
599 578
         // Configure connection adapter.
Please login to merge, or discard this patch.
Classes/Common/MetsDocument.php 1 patch
Braces   +27 added lines, -54 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@  discard block
 block discarded – undo
47 47
  * @property-read string $thumbnail This holds the document's thumbnail location
48 48
  * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF)
49 49
  */
50
-final class MetsDocument extends Doc
51
-{
50
+final class MetsDocument extends Doc {
52 51
     /**
53 52
      * This holds the whole XML file as string for serialization purposes
54 53
      * @see __sleep() / __wakeup()
@@ -127,8 +126,7 @@  discard block
 block discarded – undo
127 126
      *
128 127
      * @return  void
129 128
      */
130
-    public function addMetadataFromMets(&$metadata, $id)
131
-    {
129
+    public function addMetadataFromMets(&$metadata, $id) {
132 130
         $details = $this->getLogicalStructure($id);
133 131
         if (!empty($details)) {
134 132
             $metadata['mets_order'][0] = $details['order'];
@@ -142,8 +140,7 @@  discard block
 block discarded – undo
142 140
      * {@inheritDoc}
143 141
      * @see \Kitodo\Dlf\Common\Doc::establishRecordId()
144 142
      */
145
-    protected function establishRecordId($pid)
146
-    {
143
+    protected function establishRecordId($pid) {
147 144
         // Check for METS object @ID.
148 145
         if (!empty($this->mets['OBJID'])) {
149 146
             $this->recordId = (string) $this->mets['OBJID'];
@@ -163,8 +160,7 @@  discard block
 block discarded – undo
163 160
      * {@inheritDoc}
164 161
      * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation()
165 162
      */
166
-    public function getDownloadLocation($id)
167
-    {
163
+    public function getDownloadLocation($id) {
168 164
         $fileMimeType = $this->getFileMimeType($id);
169 165
         $fileLocation = $this->getFileLocation($id);
170 166
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
@@ -189,8 +185,7 @@  discard block
 block discarded – undo
189 185
      * {@inheritDoc}
190 186
      * @see \Kitodo\Dlf\Common\Doc::getFileLocation()
191 187
      */
192
-    public function getFileLocation($id)
193
-    {
188
+    public function getFileLocation($id) {
194 189
         $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
195 190
         if (
196 191
             !empty($id)
@@ -207,8 +202,7 @@  discard block
 block discarded – undo
207 202
      * {@inheritDoc}
208 203
      * @see \Kitodo\Dlf\Common\Doc::getFileMimeType()
209 204
      */
210
-    public function getFileMimeType($id)
211
-    {
205
+    public function getFileMimeType($id) {
212 206
         $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
213 207
         if (
214 208
             !empty($id)
@@ -225,8 +219,7 @@  discard block
 block discarded – undo
225 219
      * {@inheritDoc}
226 220
      * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
227 221
      */
228
-    public function getLogicalStructure($id, $recursive = false)
229
-    {
222
+    public function getLogicalStructure($id, $recursive = false) {
230 223
         $details = [];
231 224
         // Is the requested logical unit already loaded?
232 225
         if (
@@ -266,8 +259,7 @@  discard block
 block discarded – undo
266 259
      *
267 260
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
268 261
      */
269
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
270
-    {
262
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) {
271 263
         // Get attributes.
272 264
         foreach ($structure->attributes() as $attribute => $value) {
273 265
             $attributes[$attribute] = (string) $value;
@@ -365,8 +357,7 @@  discard block
 block discarded – undo
365 357
      * {@inheritDoc}
366 358
      * @see \Kitodo\Dlf\Common\Doc::getMetadata()
367 359
      */
368
-    public function getMetadata($id, $cPid = 0)
369
-    {
360
+    public function getMetadata($id, $cPid = 0) {
370 361
         // Make sure $cPid is a non-negative integer.
371 362
         $cPid = max(intval($cPid), 0);
372 363
         // If $cPid is not given, try to get it elsewhere.
@@ -604,8 +595,7 @@  discard block
 block discarded – undo
604 595
      * {@inheritDoc}
605 596
      * @see \Kitodo\Dlf\Common\Doc::getFullText()
606 597
      */
607
-    public function getFullText($id)
608
-    {
598
+    public function getFullText($id) {
609 599
         $fullText = '';
610 600
 
611 601
         // Load fileGrps and check for full text files.
@@ -620,8 +610,7 @@  discard block
 block discarded – undo
620 610
      * {@inheritDoc}
621 611
      * @see Doc::getStructureDepth()
622 612
      */
623
-    public function getStructureDepth($logId)
624
-    {
613
+    public function getStructureDepth($logId) {
625 614
         $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
626 615
         if (!empty($ancestors)) {
627 616
             return count($ancestors);
@@ -634,8 +623,7 @@  discard block
 block discarded – undo
634 623
      * {@inheritDoc}
635 624
      * @see \Kitodo\Dlf\Common\Doc::init()
636 625
      */
637
-    protected function init($location)
638
-    {
626
+    protected function init($location) {
639 627
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this));
640 628
         // Get METS node from XML file.
641 629
         $this->registerNamespaces($this->xml);
@@ -659,8 +647,7 @@  discard block
 block discarded – undo
659 647
      * {@inheritDoc}
660 648
      * @see \Kitodo\Dlf\Common\Doc::loadLocation()
661 649
      */
662
-    protected function loadLocation($location)
663
-    {
650
+    protected function loadLocation($location) {
664 651
         $fileResource = Helper::getUrl($location);
665 652
         if ($fileResource !== false) {
666 653
             $xml = Helper::getXmlFileAsString($fileResource);
@@ -678,8 +665,7 @@  discard block
 block discarded – undo
678 665
      * {@inheritDoc}
679 666
      * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet()
680 667
      */
681
-    protected function ensureHasFulltextIsSet()
682
-    {
668
+    protected function ensureHasFulltextIsSet() {
683 669
         // Are the fileGrps already loaded?
684 670
         if (!$this->fileGrpsLoaded) {
685 671
             $this->_getFileGrps();
@@ -690,8 +676,7 @@  discard block
 block discarded – undo
690 676
      * {@inheritDoc}
691 677
      * @see Doc::setPreloadedDocument()
692 678
      */
693
-    protected function setPreloadedDocument($preloadedDocument)
694
-    {
679
+    protected function setPreloadedDocument($preloadedDocument) {
695 680
 
696 681
         if ($preloadedDocument instanceof \SimpleXMLElement) {
697 682
             $this->xml = $preloadedDocument;
@@ -704,8 +689,7 @@  discard block
 block discarded – undo
704 689
      * {@inheritDoc}
705 690
      * @see Doc::getDocument()
706 691
      */
707
-    protected function getDocument()
708
-    {
692
+    protected function getDocument() {
709 693
         return $this->mets;
710 694
     }
711 695
 
@@ -716,8 +700,7 @@  discard block
 block discarded – undo
716 700
      *
717 701
      * @return array Array of dmdSecs with their IDs as array key
718 702
      */
719
-    protected function _getDmdSec()
720
-    {
703
+    protected function _getDmdSec() {
721 704
         if (!$this->dmdSecLoaded) {
722 705
             // Get available data formats.
723 706
             $this->loadFormats();
@@ -755,8 +738,7 @@  discard block
 block discarded – undo
755 738
      *
756 739
      * @return array Array of file use groups with file IDs
757 740
      */
758
-    protected function _getFileGrps()
759
-    {
741
+    protected function _getFileGrps() {
760 742
         if (!$this->fileGrpsLoaded) {
761 743
             // Get configured USE attributes.
762 744
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -801,8 +783,7 @@  discard block
 block discarded – undo
801 783
      * {@inheritDoc}
802 784
      * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
803 785
      */
804
-    protected function prepareMetadataArray($cPid)
805
-    {
786
+    protected function prepareMetadataArray($cPid) {
806 787
         $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID');
807 788
         // Get all logical structure nodes with metadata.
808 789
         if (!empty($ids)) {
@@ -820,8 +801,7 @@  discard block
 block discarded – undo
820 801
      *
821 802
      * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object
822 803
      */
823
-    protected function _getMets()
824
-    {
804
+    protected function _getMets() {
825 805
         return $this->mets;
826 806
     }
827 807
 
@@ -829,8 +809,7 @@  discard block
 block discarded – undo
829 809
      * {@inheritDoc}
830 810
      * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure()
831 811
      */
832
-    protected function _getPhysicalStructure()
833
-    {
812
+    protected function _getPhysicalStructure() {
834 813
         // Is there no physical structure array yet?
835 814
         if (!$this->physicalStructureLoaded) {
836 815
             // Does the document have a structMap node of type "PHYSICAL"?
@@ -890,8 +869,7 @@  discard block
 block discarded – undo
890 869
      * {@inheritDoc}
891 870
      * @see \Kitodo\Dlf\Common\Doc::_getSmLinks()
892 871
      */
893
-    protected function _getSmLinks()
894
-    {
872
+    protected function _getSmLinks() {
895 873
         if (!$this->smLinksLoaded) {
896 874
             $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
897 875
             if (!empty($smLinks)) {
@@ -909,8 +887,7 @@  discard block
 block discarded – undo
909 887
      * {@inheritDoc}
910 888
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
911 889
      */
912
-    protected function _getThumbnail($forceReload = false)
913
-    {
890
+    protected function _getThumbnail($forceReload = false) {
914 891
         if (
915 892
             !$this->thumbnailLoaded
916 893
             || $forceReload
@@ -989,8 +966,7 @@  discard block
 block discarded – undo
989 966
      * {@inheritDoc}
990 967
      * @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
991 968
      */
992
-    protected function _getToplevelId()
993
-    {
969
+    protected function _getToplevelId() {
994 970
         if (empty($this->toplevelId)) {
995 971
             // Get all logical structure nodes with metadata, but without associated METS-Pointers.
996 972
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]');
@@ -1022,8 +998,7 @@  discard block
 block discarded – undo
1022 998
      *
1023 999
      * @return array Properties to be serialized
1024 1000
      */
1025
-    public function __sleep()
1026
-    {
1001
+    public function __sleep() {
1027 1002
         // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
1028 1003
         $this->asXML = $this->xml->asXML();
1029 1004
         return ['uid', 'pid', 'recordId', 'parentId', 'asXML'];
@@ -1036,8 +1011,7 @@  discard block
 block discarded – undo
1036 1011
      *
1037 1012
      * @return string String representing the METS object
1038 1013
      */
1039
-    public function __toString()
1040
-    {
1014
+    public function __toString() {
1041 1015
         $xml = new \DOMDocument('1.0', 'utf-8');
1042 1016
         $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1043 1017
         $xml->formatOutput = true;
@@ -1052,8 +1026,7 @@  discard block
 block discarded – undo
1052 1026
      *
1053 1027
      * @return void
1054 1028
      */
1055
-    public function __wakeup()
1056
-    {
1029
+    public function __wakeup() {
1057 1030
         $xml = Helper::getXmlFileAsString($this->asXML);
1058 1031
         if ($xml !== false) {
1059 1032
             $this->asXML = '';
Please login to merge, or discard this patch.
Classes/Common/SolrSearchResult/ResultDocument.php 1 patch
Braces   +19 added lines, -38 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
@@ -134,8 +133,7 @@  discard block
 block discarded – undo
134 133
      *
135 134
      * @return void
136 135
      */
137
-    public function __construct($record, $highlighting, $fields)
138
-    {
136
+    public function __construct($record, $highlighting, $fields) {
139 137
         $this->id = $record[$fields['id']];
140 138
         $this->uid = $record[$fields['uid']];
141 139
         $this->page = $record[$fields['page']];
@@ -160,8 +158,7 @@  discard block
 block discarded – undo
160 158
      *
161 159
      * @return string The result's record identifier
162 160
      */
163
-    public function getId()
164
-    {
161
+    public function getId() {
165 162
         return $this->id;
166 163
     }
167 164
 
@@ -172,8 +169,7 @@  discard block
 block discarded – undo
172 169
      *
173 170
      * @return string|null The result's record unified identifier
174 171
      */
175
-    public function getUid()
176
-    {
172
+    public function getUid() {
177 173
         return $this->uid;
178 174
     }
179 175
 
@@ -184,8 +180,7 @@  discard block
 block discarded – undo
184 180
      *
185 181
      * @return int The result's record page
186 182
      */
187
-    public function getPage()
188
-    {
183
+    public function getPage() {
189 184
         return $this->page;
190 185
     }
191 186
 
@@ -196,8 +191,7 @@  discard block
 block discarded – undo
196 191
      *
197 192
      * @return string All result's record snippets imploded to one string
198 193
      */
199
-    public function getSnippets()
200
-    {
194
+    public function getSnippets() {
201 195
         return $this->snippets;
202 196
     }
203 197
 
@@ -208,8 +202,7 @@  discard block
 block discarded – undo
208 202
      *
209 203
      * @return string
210 204
      */
211
-    public function getThumbnail()
212
-    {
205
+    public function getThumbnail() {
213 206
         return $this->thumbnail;
214 207
     }
215 208
 
@@ -220,8 +213,7 @@  discard block
 block discarded – undo
220 213
      *
221 214
      * @return string
222 215
      */
223
-    public function getTitle()
224
-    {
216
+    public function getTitle() {
225 217
         return $this->title;
226 218
     }
227 219
 
@@ -232,8 +224,7 @@  discard block
 block discarded – undo
232 224
      *
233 225
      * @return boolean
234 226
      */
235
-    public function getToplevel()
236
-    {
227
+    public function getToplevel() {
237 228
         return $this->toplevel;
238 229
     }
239 230
 
@@ -244,8 +235,7 @@  discard block
 block discarded – undo
244 235
      *
245 236
      * @return string
246 237
      */
247
-    public function getType()
248
-    {
238
+    public function getType() {
249 239
         return $this->type;
250 240
     }
251 241
 
@@ -256,8 +246,7 @@  discard block
 block discarded – undo
256 246
      *
257 247
      * @return array(Page) All result's pages which contain search phrase
258 248
      */
259
-    public function getPages()
260
-    {
249
+    public function getPages() {
261 250
         return $this->pages;
262 251
     }
263 252
 
@@ -268,8 +257,7 @@  discard block
 block discarded – undo
268 257
      *
269 258
      * @return array(Region) All result's regions which contain search phrase
270 259
      */
271
-    public function getRegions()
272
-    {
260
+    public function getRegions() {
273 261
         return $this->regions;
274 262
     }
275 263
 
@@ -280,8 +268,7 @@  discard block
 block discarded – undo
280 268
      *
281 269
      * @return array(Highlight) All result's highlights of search phrase
282 270
      */
283
-    public function getHighlights()
284
-    {
271
+    public function getHighlights() {
285 272
         return $this->highlights;
286 273
     }
287 274
 
@@ -292,8 +279,7 @@  discard block
 block discarded – undo
292 279
      *
293 280
      * @return array(string) All result's highlights of search phrase
294 281
      */
295
-    public function getHighlightsIds()
296
-    {
282
+    public function getHighlightsIds() {
297 283
         $highlightsIds = [];
298 284
         foreach ($this->highlights as $highlight) {
299 285
             array_push($highlightsIds, $highlight->getId());
@@ -309,8 +295,7 @@  discard block
 block discarded – undo
309 295
      *
310 296
      * @return void
311 297
      */
312
-    private function parseSnippets()
313
-    {
298
+    private function parseSnippets() {
314 299
         $snippetArray = $this->getArrayByIndex('text');
315 300
 
316 301
         $this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : '';
@@ -324,8 +309,7 @@  discard block
 block discarded – undo
324 309
      *
325 310
      * @return void
326 311
      */
327
-    private function parsePages()
328
-    {
312
+    private function parsePages() {
329 313
         $pageArray = $this->getArrayByIndex('pages');
330 314
 
331 315
         $i = 0;
@@ -345,8 +329,7 @@  discard block
 block discarded – undo
345 329
      *
346 330
      * @return void
347 331
      */
348
-    private function parseRegions()
349
-    {
332
+    private function parseRegions() {
350 333
         $regionArray = $this->getArrayByIndex('regions');
351 334
 
352 335
         $i = 0;
@@ -366,8 +349,7 @@  discard block
 block discarded – undo
366 349
      *
367 350
      * @return void
368 351
      */
369
-    private function parseHighlights()
370
-    {
352
+    private function parseHighlights() {
371 353
         $highlightArray = $this->getArrayByIndex('highlights');
372 354
 
373 355
         foreach ($highlightArray as $highlights) {
@@ -388,8 +370,7 @@  discard block
 block discarded – undo
388 370
      *
389 371
      * @return array
390 372
      */
391
-    private function getArrayByIndex($index)
392
-    {
373
+    private function getArrayByIndex($index) {
393 374
         $objectArray = [];
394 375
         foreach ($this->snippetsForRecord as $snippet) {
395 376
             if (!empty($snippet[$index])) {
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
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  * @subpackage dlf
33 33
  * @access public
34 34
  */
35
-class Indexer
36
-{
35
+class Indexer {
37 36
     /**
38 37
      * The extension key
39 38
      *
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
      *
94 93
      * @return bool true on success or false on failure
95 94
      */
96
-    public static function add(Document $document)
97
-    {
95
+    public static function add(Document $document) {
98 96
         if (in_array($document->getUid(), self::$processedDocs)) {
99 97
             return true;
100 98
         } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) {
@@ -209,8 +207,7 @@  discard block
 block discarded – undo
209 207
      *
210 208
      * @return string The field's dynamic index name
211 209
      */
212
-    public static function getIndexFieldName($index_name, $pid = 0)
213
-    {
210
+    public static function getIndexFieldName($index_name, $pid = 0) {
214 211
         // Sanitize input.
215 212
         $pid = max(intval($pid), 0);
216 213
         if (!$pid) {
@@ -236,8 +233,7 @@  discard block
 block discarded – undo
236 233
      *
237 234
      * @return void
238 235
      */
239
-    protected static function loadIndexConf($pid)
240
-    {
236
+    protected static function loadIndexConf($pid) {
241 237
         if (!self::$fieldsLoaded) {
242 238
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
243 239
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -307,8 +303,7 @@  discard block
 block discarded – undo
307 303
      *
308 304
      * @return bool true on success or false on failure
309 305
      */
310
-    protected static function processLogical(Document $document, array $logicalUnit)
311
-    {
306
+    protected static function processLogical(Document $document, array $logicalUnit) {
312 307
         $success = true;
313 308
         $doc = $document->getDoc();
314 309
         $doc->cPid = $document->getPid();
@@ -436,8 +431,7 @@  discard block
 block discarded – undo
436 431
      *
437 432
      * @return bool true on success or false on failure
438 433
      */
439
-    protected static function processPhysical(Document $document, $page, array $physicalUnit)
440
-    {
434
+    protected static function processPhysical(Document $document, $page, array $physicalUnit) {
441 435
         $doc = $document->getDoc();
442 436
         $doc->cPid = $document->getPid();
443 437
         if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) {
@@ -525,8 +519,7 @@  discard block
 block discarded – undo
525 519
      *
526 520
      * @return bool true on success or false on failure
527 521
      */
528
-    protected static function solrConnect($core, $pid = 0)
529
-    {
522
+    protected static function solrConnect($core, $pid = 0) {
530 523
         // Get Solr instance.
531 524
         if (!self::$solr) {
532 525
             // Connect to Solr server.
@@ -549,8 +542,7 @@  discard block
 block discarded – undo
549 542
      *
550 543
      * @access private
551 544
      */
552
-    private function __construct()
553
-    {
545
+    private function __construct() {
554 546
         // This is a static class, thus no instances should be created.
555 547
     }
556 548
 }
Please login to merge, or discard this patch.
Classes/Command/BaseCommand.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@  discard block
 block discarded – undo
38 38
  * @subpackage dlf
39 39
  * @access public
40 40
  */
41
-class BaseCommand extends Command
42
-{
41
+class BaseCommand extends Command {
43 42
     /**
44 43
      * @var CollectionRepository
45 44
      */
@@ -79,8 +78,7 @@  discard block
 block discarded – undo
79 78
      *
80 79
      * @return bool
81 80
      */
82
-    protected function initializeRepositories($storagePid)
83
-    {
81
+    protected function initializeRepositories($storagePid) {
84 82
         if (MathUtility::canBeInterpretedAsInteger($storagePid)) {
85 83
             $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
86 84
             $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
@@ -159,8 +157,7 @@  discard block
 block discarded – undo
159 157
      *
160 158
      * @return bool true on success
161 159
      */
162
-    protected function saveToDatabase(Document $document)
163
-    {
160
+    protected function saveToDatabase(Document $document) {
164 161
         $success = false;
165 162
 
166 163
         $doc = $document->getDoc();
@@ -268,8 +265,7 @@  discard block
 block discarded – undo
268 265
      *
269 266
      * @return int The parent document's id.
270 267
      */
271
-    protected function getParentDocumentUidForSaving(Document $document)
272
-    {
268
+    protected function getParentDocumentUidForSaving(Document $document) {
273 269
         $doc = $document->getDoc();
274 270
 
275 271
         if ($doc !== null) {
Please login to merge, or discard this patch.
Classes/Command/IndexCommand.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,16 +33,14 @@  discard block
 block discarded – undo
33 33
  * @subpackage dlf
34 34
  * @access public
35 35
  */
36
-class IndexCommand extends BaseCommand
37
-{
36
+class IndexCommand extends BaseCommand {
38 37
 
39 38
     /**
40 39
      * Configure the command by defining the name, options and arguments
41 40
      *
42 41
      * @return void
43 42
      */
44
-    public function configure()
45
-    {
43
+    public function configure() {
46 44
         $this
47 45
             ->setDescription('Index single document into database and Solr.')
48 46
             ->setHelp('')
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      *
87 85
      * @return int
88 86
      */
89
-    protected function execute(InputInterface $input, OutputInterface $output)
90
-    {
87
+    protected function execute(InputInterface $input, OutputInterface $output) {
91 88
         $dryRun = $input->getOption('dry-run') != false ? true : false;
92 89
 
93 90
         $io = new SymfonyStyle($input, $output);
Please login to merge, or discard this patch.
Classes/Command/ReindexCommand.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,15 +32,13 @@  discard block
 block discarded – undo
32 32
  * @subpackage dlf
33 33
  * @access public
34 34
  */
35
-class ReindexCommand extends BaseCommand
36
-{
35
+class ReindexCommand extends BaseCommand {
37 36
     /**
38 37
      * Configure the command by defining the name, options and arguments
39 38
      *
40 39
      * @return void
41 40
      */
42
-    public function configure()
43
-    {
41
+    public function configure() {
44 42
         $this
45 43
             ->setDescription('Reindex a collection into database and Solr.')
46 44
             ->setHelp('')
@@ -90,8 +88,7 @@  discard block
 block discarded – undo
90 88
      *
91 89
      * @return int
92 90
      */
93
-    protected function execute(InputInterface $input, OutputInterface $output)
94
-    {
91
+    protected function execute(InputInterface $input, OutputInterface $output) {
95 92
         $dryRun = $input->getOption('dry-run') != false ? true : false;
96 93
 
97 94
         $io = new SymfonyStyle($input, $output);
Please login to merge, or discard this patch.
Classes/Command/HarvestCommand.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,15 +36,13 @@  discard block
 block discarded – undo
36 36
  * @subpackage dlf
37 37
  * @access public
38 38
  */
39
-class HarvestCommand extends BaseCommand
40
-{
39
+class HarvestCommand extends BaseCommand {
41 40
     /**
42 41
      * Configure the command by defining the name, options and arguments
43 42
      *
44 43
      * @return void
45 44
      */
46
-    public function configure()
47
-    {
45
+    public function configure() {
48 46
         $this
49 47
             ->setDescription('Harvest OAI-PMH contents into database and Solr.')
50 48
             ->setHelp('')
@@ -100,8 +98,7 @@  discard block
 block discarded – undo
100 98
      *
101 99
      * @return int
102 100
      */
103
-    protected function execute(InputInterface $input, OutputInterface $output)
104
-    {
101
+    protected function execute(InputInterface $input, OutputInterface $output) {
105 102
         $dryRun = $input->getOption('dry-run') != false ? true : false;
106 103
 
107 104
         $io = new SymfonyStyle($input, $output);
@@ -265,8 +262,7 @@  discard block
 block discarded – undo
265 262
      *
266 263
      * @return void
267 264
      */
268
-    protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io)
269
-    {
265
+    protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) {
270 266
         $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n    " . $exception->getMessage());
271 267
     }
272 268
 }
Please login to merge, or discard this patch.
Classes/Updates/MigrateSettings.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
  * Class MigrateSettings
24 24
  * @internal
25 25
  */
26
-class MigrateSettings implements UpgradeWizardInterface
27
-{
26
+class MigrateSettings implements UpgradeWizardInterface {
28 27
 
29 28
     /**
30 29
      * Return the identifier for this wizard
Please login to merge, or discard this patch.