Passed
Pull Request — master (#123)
by
unknown
06:40
created
Classes/Common/StdOutStream.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@
 block discarded – undo
33 33
      * 
34 34
      * @return void
35 35
      */
36
-    public function emit()
37
-    {
36
+    public function emit() {
38 37
         // Disable output buffering
39 38
         ob_end_flush();
40 39
 
Please login to merge, or discard this patch.
Classes/Common/MetadataInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
  *
23 23
  * @abstract
24 24
  */
25
-interface MetadataInterface
26
-{
25
+interface MetadataInterface {
27 26
     /**
28 27
      * This extracts metadata from XML
29 28
      *
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 3 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @access public
34 34
  */
35
-class Indexer
36
-{
35
+class Indexer {
37 36
     /**
38 37
      * @access public
39 38
      * @static
@@ -604,8 +603,7 @@  discard block
 block discarded – undo
604 603
      *
605 604
      * @return array|string
606 605
      */
607
-    private static function removeAppendsFromAuthor($authors)
608
-    {
606
+    private static function removeAppendsFromAuthor($authors) {
609 607
         if (is_array($authors)) {
610 608
             foreach ($authors as $i => $author) {
611 609
                 $splitName = explode(pack('C', 31), $author);
@@ -685,7 +683,6 @@  discard block
 block discarded – undo
685 683
      *
686 684
      * @return void
687 685
      */
688
-    private function __construct()
689
-    {
686
+    private function __construct() {
690 687
     }
691 688
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                         $parent->setCurrentDocument($doc);
115 115
                         $success = self::add($parent, $documentRepository);
116 116
                     } else {
117
-                        Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
117
+                        Helper::log('Could not load parent document with UID '.$document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
118 118
                         return false;
119 119
                     }
120 120
                 }
@@ -200,19 +200,19 @@  discard block
 block discarded – undo
200 200
             } catch (\Exception $e) {
201 201
                 if (!(Environment::isCli())) {
202 202
                     Helper::addMessage(
203
-                        Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
203
+                        Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()),
204 204
                         Helper::getLanguageService()->getLL('flash.error'),
205 205
                         FlashMessage::ERROR,
206 206
                         true,
207 207
                         'core.template.flashMessages'
208 208
                     );
209 209
                 }
210
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
210
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
211 211
                 return false;
212 212
             }
213 213
         }
214 214
 
215
-        Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core ' . $solrCoreUid, LOG_SEVERITY_ERROR);
215
+        Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core '.$solrCoreUid, LOG_SEVERITY_ERROR);
216 216
         return false;
217 217
     }
218 218
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         // Sanitize input.
234 234
         $pid = max((int) $pid, 0);
235 235
         if (!$pid) {
236
-            Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR);
236
+            Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR);
237 237
             return '';
238 238
         }
239 239
         // Load metadata configuration.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $suffix = (in_array($indexName, self::$fields['tokenized']) ? 't' : 'u');
243 243
         $suffix .= (in_array($indexName, self::$fields['stored']) ? 's' : 'u');
244 244
         $suffix .= (in_array($indexName, self::$fields['indexed']) ? 'i' : 'u');
245
-        $indexName .= '_' . $suffix;
245
+        $indexName .= '_'.$suffix;
246 246
         return $indexName;
247 247
     }
248 248
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 $solrDoc->setField('title', $metadata['title'][0]);
359 359
                 $solrDoc->setField('volume', $metadata['volume'][0]);
360 360
                 // verify date formatting
361
-                if(strtotime($metadata['date'][0])) {
361
+                if (strtotime($metadata['date'][0])) {
362 362
                     $solrDoc->setField('date', self::getFormattedDate($metadata['date'][0]));
363 363
                 }
364 364
                 $solrDoc->setField('record_id', $metadata['record_id'][0]);
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
                 $solrDoc->setField(self::getIndexFieldName($indexName, $document->getPid()), $data);
523 523
                 if (in_array($indexName, self::$fields['sortables'])) {
524 524
                     // Add sortable fields to index.
525
-                    $solrDoc->setField($indexName . '_sorting', $metadata[$indexName . '_sorting'][0]);
525
+                    $solrDoc->setField($indexName.'_sorting', $metadata[$indexName.'_sorting'][0]);
526 526
                 }
527 527
                 if (in_array($indexName, self::$fields['facets'])) {
528 528
                     // Add facets to index.
529
-                    $solrDoc->setField($indexName . '_faceting', $data);
529
+                    $solrDoc->setField($indexName.'_faceting', $data);
530 530
                 }
531 531
                 if (in_array($indexName, self::$fields['autocomplete'])) {
532 532
                     $autocomplete = array_merge($autocomplete, $data);
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                         $data = self::removeAppendsFromAuthor($data);
564 564
                     }
565 565
                     // Add facets to index.
566
-                    $solrDoc->setField($indexName . '_faceting', $data);
566
+                    $solrDoc->setField($indexName.'_faceting', $data);
567 567
                 }
568 568
             }
569 569
             // Add sorting information to physical sub-elements if applicable.
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
         $update = self::$solr->service->createUpdate();
595 595
         $query = "";
596 596
         if ($field == 'uid' || $field == 'partof') {
597
-            $query = $field . ':' . $value;
597
+            $query = $field.':'.$value;
598 598
         } else {
599
-            $query = $field . ':"' . $value . '"';
599
+            $query = $field.':"'.$value.'"';
600 600
         }
601 601
         $update->addDeleteQuery($query);
602 602
         $update->addCommit($softCommit);
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
     {
622 622
         $solrDoc = $updateQuery->createDocument();
623 623
         // Create unique identifier from document's UID and unit's XML ID.
624
-        $solrDoc->setField('id', $document->getUid() . $unit['id']);
624
+        $solrDoc->setField('id', $document->getUid().$unit['id']);
625 625
         $solrDoc->setField('uid', $document->getUid());
626 626
         $solrDoc->setField('pid', $document->getPid());
627 627
         $solrDoc->setField('partof', $document->getPartof());
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
     private static function handleException(string $errorMessage): void
701 701
     {
702 702
         if (!(Environment::isCli())) {
703
-            self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($errorMessage));
703
+            self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($errorMessage));
704 704
         }
705
-        Helper::log('Apache Solr threw exception: "' . $errorMessage . '"', LOG_SEVERITY_ERROR);
705
+        Helper::log('Apache Solr threw exception: "'.$errorMessage.'"', LOG_SEVERITY_ERROR);
706 706
     }
707 707
 
708 708
     /**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @see $fields
68 68
      */
69
-    protected static bool $fieldsLoaded = false;
69
+    protected static bool $fieldsLoaded = FALSE;
70 70
 
71 71
     /**
72 72
      * @access protected
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
      *
96 96
      * @return bool true on success or false on failure
97 97
      */
98
-    public static function add(Document $document, DocumentRepository $documentRepository, bool $softCommit = false): bool
98
+    public static function add(Document $document, DocumentRepository $documentRepository, bool $softCommit = FALSE): bool
99 99
     {
100 100
         if (in_array($document->getUid(), self::$processedDocs)) {
101
-            return true;
101
+            return TRUE;
102 102
         } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) {
103
-            $success = true;
103
+            $success = TRUE;
104 104
             Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf');
105 105
             // Handle multi-volume documents.
106 106
             $parentId = $document->getPartof();
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
                 $parent = $documentRepository->findByUid($parentId);
110 110
                 if ($parent) {
111 111
                     // get XML document of parent
112
-                    $doc = AbstractDocument::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true);
113
-                    if ($doc !== null) {
112
+                    $doc = AbstractDocument::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE);
113
+                    if ($doc !== NULL) {
114 114
                         $parent->setCurrentDocument($doc);
115 115
                         $success = self::add($parent, $documentRepository);
116 116
                     } else {
117 117
                         Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
118
-                        return false;
118
+                        return FALSE;
119 119
                     }
120 120
                 }
121 121
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 return $success;
163 163
             } catch (\Exception $e) {
164 164
                 self::handleException($e->getMessage());
165
-                return false;
165
+                return FALSE;
166 166
             }
167 167
         } else {
168 168
             if (!(Environment::isCli())) {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                 );
174 174
             }
175 175
             Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR);
176
-            return false;
176
+            return FALSE;
177 177
         }
178 178
     }
179 179
 
@@ -191,29 +191,29 @@  discard block
 block discarded – undo
191 191
      *
192 192
      * @return bool true on success or false on failure
193 193
      */
194
-    public static function delete(InputInterface $input, string $field, int $solrCoreUid, bool $softCommit = false): bool
194
+    public static function delete(InputInterface $input, string $field, int $solrCoreUid, bool $softCommit = FALSE): bool
195 195
     {
196 196
         if (self::solrConnect($solrCoreUid, $input->getOption('pid'))) {
197 197
             try {
198 198
                 self::deleteDocument($field, $input->getOption('doc'), $softCommit);
199
-                return true;
199
+                return TRUE;
200 200
             } catch (\Exception $e) {
201 201
                 if (!(Environment::isCli())) {
202 202
                     Helper::addMessage(
203 203
                         Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
204 204
                         Helper::getLanguageService()->getLL('flash.error'),
205 205
                         FlashMessage::ERROR,
206
-                        true,
206
+                        TRUE,
207 207
                         'core.template.flashMessages'
208 208
                     );
209 209
                 }
210 210
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
211
-                return false;
211
+                return FALSE;
212 212
             }
213 213
         }
214 214
 
215 215
         Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core ' . $solrCoreUid, LOG_SEVERITY_ERROR);
216
-        return false;
216
+        return FALSE;
217 217
     }
218 218
 
219 219
     /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                     self::$fields['autocomplete'][] = $indexing['index_name'];
310 310
                 }
311 311
             }
312
-            self::$fieldsLoaded = true;
312
+            self::$fieldsLoaded = TRUE;
313 313
         }
314 314
     }
315 315
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      */
328 328
     protected static function processLogical(Document $document, array $logicalUnit): bool
329 329
     {
330
-        $success = true;
330
+        $success = TRUE;
331 331
         $doc = $document->getCurrentDocument();
332 332
         $doc->cPid = $document->getPid();
333 333
         // Get metadata for logical unit.
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
                     $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId']));
355 355
                 }
356 356
                 // There can be only one toplevel unit per UID, independently of backend configuration
357
-                $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false);
357
+                $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE);
358 358
                 $solrDoc->setField('title', $metadata['title'][0]);
359 359
                 $solrDoc->setField('volume', $metadata['volume'][0]);
360 360
                 // verify date formatting
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
                     self::$solr->service->update($updateQuery);
391 391
                 } catch (\Exception $e) {
392 392
                     self::handleException($e->getMessage());
393
-                    return false;
393
+                    return FALSE;
394 394
                 }
395 395
             } else {
396 396
                 Helper::log('Tip: If "record_id" field is missing then there is possibility that METS file still contains it but with the wrong source type attribute in "recordIdentifier" element', LOG_SEVERITY_NOTICE);
397
-                return false;
397
+                return FALSE;
398 398
             }
399 399
         }
400 400
         // Check for child elements...
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
                     break;
443 443
                 }
444 444
             }
445
-            $solrDoc->setField('toplevel', false);
445
+            $solrDoc->setField('toplevel', FALSE);
446 446
             $solrDoc->setField('type', $physicalUnit['type']);
447 447
             $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']);
448 448
             $solrDoc->setField('location', $document->getLocation());
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
                 self::$solr->service->update($updateQuery);
464 464
             } catch (\Exception $e) {
465 465
                 self::handleException($e->getMessage());
466
-                return false;
466
+                return FALSE;
467 467
             }
468 468
         }
469
-        return true;
469
+        return TRUE;
470 470
     }
471 471
 
472 472
     /**
@@ -492,9 +492,9 @@  discard block
 block discarded – undo
492 492
             if ($pid) {
493 493
                 self::loadIndexConf($pid);
494 494
             }
495
-            return true;
495
+            return TRUE;
496 496
         }
497
-        return false;
497
+        return FALSE;
498 498
     }
499 499
 
500 500
     /**
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      *
590 590
      * @return void
591 591
      */
592
-    private static function deleteDocument(string $field, string $value, bool $softCommit = false): void
592
+    private static function deleteDocument(string $field, string $value, bool $softCommit = FALSE): void
593 593
     {
594 594
         $update = self::$solr->service->createUpdate();
595 595
         $query = "";
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
             $message,
745 745
             Helper::getLanguageService()->getLL($type),
746 746
             $status,
747
-            true,
747
+            TRUE,
748 748
             'core.template.flashMessages'
749 749
         );
750 750
     }
Please login to merge, or discard this patch.
Classes/Common/AbstractDocument.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -664,14 +664,14 @@  discard block
 block discarded – undo
664 664
                     if ($fileContent !== false) {
665 665
                         $textFormat = $this->getTextFormat($fileContent);
666 666
                     } else {
667
-                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
667
+                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"');
668 668
                         return $fullText;
669 669
                     }
670 670
                     break;
671 671
                 }
672 672
             }
673 673
         } else {
674
-            $this->logger->warning('Invalid structure node @ID "' . $id . '"');
674
+            $this->logger->warning('Invalid structure node @ID "'.$id.'"');
675 675
             return $fullText;
676 676
         }
677 677
         // Is this text format supported?
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
             }
684 684
             $fullText = $textMiniOcr;
685 685
         } else {
686
-            $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"');
686
+            $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"');
687 687
         }
688 688
         return $fullText;
689 689
     }
@@ -712,10 +712,10 @@  discard block
 block discarded – undo
712 712
                 $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml);
713 713
                 $this->rawTextArray[$id] = $textMiniOcr;
714 714
             } else {
715
-                $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"');
715
+                $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"');
716 716
             }
717 717
         } else {
718
-            $this->logger->warning('Class "' . $class . ' does not exists for "' . $textFormat . ' text format"');
718
+            $this->logger->warning('Class "'.$class.' does not exists for "'.$textFormat.' text format"');
719 719
         }
720 720
         return $textMiniOcr;
721 721
     }
@@ -790,10 +790,10 @@  discard block
 block discarded – undo
790 790
                     $title = self::getTitle($partof, true);
791 791
                 }
792 792
             } else {
793
-                Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
793
+                Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING);
794 794
             }
795 795
         } else {
796
-            Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR);
796
+            Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR);
797 797
         }
798 798
         return $title;
799 799
     }
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
             // the actual loading is format specific
884 884
             return $this->loadLocation($location);
885 885
         } else {
886
-            $this->logger->error('Invalid file location "' . $location . '" for document loading');
886
+            $this->logger->error('Invalid file location "'.$location.'" for document loading');
887 887
         }
888 888
         return false;
889 889
     }
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
         // Set metadata definitions' PID.
1036 1036
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
1037 1037
         if (!$cPid) {
1038
-            $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions');
1038
+            $this->logger->error('Invalid PID '.$cPid.' for metadata definitions');
1039 1039
             return [];
1040 1040
         }
1041 1041
         if (
@@ -1212,12 +1212,12 @@  discard block
 block discarded – undo
1212 1212
      */
1213 1213
     public function __get(string $var)
1214 1214
     {
1215
-        $method = 'magicGet' . ucfirst($var);
1215
+        $method = 'magicGet'.ucfirst($var);
1216 1216
         if (
1217 1217
             !property_exists($this, $var)
1218 1218
             || !method_exists($this, $method)
1219 1219
         ) {
1220
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
1220
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
1221 1221
             return null;
1222 1222
         } else {
1223 1223
             return $this->$method();
@@ -1250,12 +1250,12 @@  discard block
 block discarded – undo
1250 1250
      */
1251 1251
     public function __set(string $var, $value): void
1252 1252
     {
1253
-        $method = '_set' . ucfirst($var);
1253
+        $method = '_set'.ucfirst($var);
1254 1254
         if (
1255 1255
             !property_exists($this, $var)
1256 1256
             || !method_exists($this, $method)
1257 1257
         ) {
1258
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
1258
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
1259 1259
         } else {
1260 1260
             $this->$method($value);
1261 1261
         }
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @property-read string $toplevelId this holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF)
58 58
  * @property \SimpleXMLElement $xml this holds the whole XML file as \SimpleXMLElement object
59 59
  */
60
-abstract class AbstractDocument
61
-{
60
+abstract class AbstractDocument {
62 61
     /**
63 62
      * @access protected
64 63
      * @var Logger This holds the logger
@@ -838,8 +837,7 @@  discard block
 block discarded – undo
838 837
      * @return int|bool false if structure with $logId is not a child of this substructure,
839 838
      * or the actual depth.
840 839
      */
841
-    protected function getTreeDepth(array $structure, int $depth, string $logId)
842
-    {
840
+    protected function getTreeDepth(array $structure, int $depth, string $logId) {
843 841
         foreach ($structure as $element) {
844 842
             if ($element['id'] == $logId) {
845 843
                 return $depth;
@@ -862,8 +860,7 @@  discard block
 block discarded – undo
862 860
      *
863 861
      * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC.
864 862
      */
865
-    public function getStructureDepth(string $logId)
866
-    {
863
+    public function getStructureDepth(string $logId) {
867 864
         return $this->getTreeDepth($this->magicGetTableOfContents(), 1, $logId);
868 865
     }
869 866
 
@@ -1122,8 +1119,7 @@  discard block
 block discarded – undo
1122 1119
      *
1123 1120
      * @return mixed The METS file's / IIIF manifest's record identifier
1124 1121
      */
1125
-    protected function magicGetRecordId()
1126
-    {
1122
+    protected function magicGetRecordId() {
1127 1123
         return $this->recordId;
1128 1124
     }
1129 1125
 
@@ -1193,8 +1189,7 @@  discard block
 block discarded – undo
1193 1189
      *
1194 1190
      * @return void
1195 1191
      */
1196
-    protected function __construct(int $pid, string $location, $preloadedDocument, array $settings = [])
1197
-    {
1192
+    protected function __construct(int $pid, string $location, $preloadedDocument, array $settings = []) {
1198 1193
         $this->pid = $pid;
1199 1194
         $this->setPreloadedDocument($preloadedDocument);
1200 1195
         $this->init($location, $settings);
@@ -1210,8 +1205,7 @@  discard block
 block discarded – undo
1210 1205
      *
1211 1206
      * @return mixed Value of $this->$var
1212 1207
      */
1213
-    public function __get(string $var)
1214
-    {
1208
+    public function __get(string $var) {
1215 1209
         $method = 'magicGet' . ucfirst($var);
1216 1210
         if (
1217 1211
             !property_exists($this, $var)
@@ -1272,8 +1266,7 @@  discard block
 block discarded – undo
1272 1266
      *
1273 1267
      * @return AbstractDocument|false
1274 1268
      */
1275
-    private static function getDocumentCache(string $location)
1276
-    {
1269
+    private static function getDocumentCache(string $location) {
1277 1270
         $cacheIdentifier = hash('md5', $location);
1278 1271
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc');
1279 1272
         $cacheHit = $cache->get($cacheIdentifier);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @see $formats
113 113
      */
114
-    protected bool $formatsLoaded = false;
114
+    protected bool $formatsLoaded = FALSE;
115 115
 
116 116
     /**
117 117
      * Are there any fulltext files available? This also includes IIIF text annotations
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
      * @access protected
122 122
      * @var bool
123 123
      */
124
-    protected bool $hasFulltext = false;
124
+    protected bool $hasFulltext = FALSE;
125 125
 
126 126
     /**
127 127
      * @access protected
128 128
      * @var array Last searched logical and physical page
129 129
      */
130
-    protected array $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null];
130
+    protected array $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL];
131 131
 
132 132
     /**
133 133
      * @access protected
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      *
151 151
      * @see $metadataArray
152 152
      */
153
-    protected bool $metadataArrayLoaded = false;
153
+    protected bool $metadataArrayLoaded = FALSE;
154 154
 
155 155
     /**
156 156
      * @access protected
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      *
183 183
      * @see $physicalStructure
184 184
      */
185
-    protected bool $physicalStructureLoaded = false;
185
+    protected bool $physicalStructureLoaded = FALSE;
186 186
 
187 187
     /**
188 188
      * @access protected
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @access protected
204 204
      * @var bool Is the document instantiated successfully?
205 205
      */
206
-    protected bool $ready = false;
206
+    protected bool $ready = FALSE;
207 207
 
208 208
     /**
209 209
      * @access protected
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      *
224 224
      * @see $rootId
225 225
      */
226
-    protected bool $rootIdLoaded = false;
226
+    protected bool $rootIdLoaded = FALSE;
227 227
 
228 228
     /**
229 229
      * @access protected
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      *
238 238
      * @see $smLinks
239 239
      */
240
-    protected bool $smLinksLoaded = false;
240
+    protected bool $smLinksLoaded = FALSE;
241 241
 
242 242
     /**
243 243
      * This holds the logical structure
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      *
254 254
      * @see $tableOfContents
255 255
      */
256
-    protected bool $tableOfContentsLoaded = false;
256
+    protected bool $tableOfContentsLoaded = FALSE;
257 257
 
258 258
     /**
259 259
      * @access protected
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      *
268 268
      * @see $thumbnail
269 269
      */
270
-    protected bool $thumbnailLoaded = false;
270
+    protected bool $thumbnailLoaded = FALSE;
271 271
 
272 272
     /**
273 273
      * @access protected
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      *
362 362
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
363 363
      */
364
-    abstract public function getLogicalStructure(string $id, bool $recursive = false): array;
364
+    abstract public function getLogicalStructure(string $id, bool $recursive = FALSE): array;
365 365
 
366 366
     /**
367 367
      * This extracts all the metadata for a logical structure node
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
      *
450 450
      * @return string The document's thumbnail location
451 451
      */
452
-    abstract protected function magicGetThumbnail(bool $forceReload = false): string;
452
+    abstract protected function magicGetThumbnail(bool $forceReload = FALSE): string;
453 453
 
454 454
     /**
455 455
      * This returns the ID of the toplevel logical structure node
@@ -528,21 +528,21 @@  discard block
 block discarded – undo
528 528
      *
529 529
      * @return AbstractDocument|null Instance of this class, either MetsDocument or IiifManifest
530 530
      */
531
-    public static function &getInstance(string $location, array $settings = [], bool $forceReload = false)
531
+    public static function &getInstance(string $location, array $settings = [], bool $forceReload = FALSE)
532 532
     {
533 533
         // Create new instance depending on format (METS or IIIF) ...
534
-        $documentFormat = null;
535
-        $xml = null;
536
-        $iiif = null;
534
+        $documentFormat = NULL;
535
+        $xml = NULL;
536
+        $iiif = NULL;
537 537
 
538 538
         if (!$forceReload) {
539 539
             $instance = self::getDocumentCache($location);
540
-            if ($instance !== false) {
540
+            if ($instance !== FALSE) {
541 541
                 return $instance;
542 542
             }
543 543
         }
544 544
 
545
-        $instance = null;
545
+        $instance = NULL;
546 546
 
547 547
         // Try to load a file from the url
548 548
         if (GeneralUtility::isValidUrl($location)) {
@@ -550,17 +550,17 @@  discard block
 block discarded – undo
550 550
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
551 551
 
552 552
             $content = Helper::getUrl($location);
553
-            if ($content !== false) {
553
+            if ($content !== FALSE) {
554 554
                 $xml = Helper::getXmlFileAsString($content);
555
-                if ($xml !== false) {
555
+                if ($xml !== FALSE) {
556 556
                     /* @var $xml \SimpleXMLElement */
557 557
                     $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/');
558 558
                     $xpathResult = $xml->xpath('//mets:mets');
559
-                    $documentFormat = !empty($xpathResult) ? 'METS' : null;
559
+                    $documentFormat = !empty($xpathResult) ? 'METS' : NULL;
560 560
                 } else {
561 561
                     // Try to load file as IIIF resource instead.
562
-                    $contentAsJsonArray = json_decode($content, true);
563
-                    if ($contentAsJsonArray !== null) {
562
+                    $contentAsJsonArray = json_decode($content, TRUE);
563
+                    if ($contentAsJsonArray !== NULL) {
564 564
                         IiifHelper::setUrlReader(IiifUrlReader::getInstance());
565 565
                         IiifHelper::setMaxThumbnailHeight($extConf['iiif']['thumbnailHeight']);
566 566
                         IiifHelper::setMaxThumbnailWidth($extConf['iiif']['thumbnailWidth']);
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             $instance = new IiifManifest($pid, $location, $iiif);
584 584
         }
585 585
 
586
-        if ($instance !== null) {
586
+        if ($instance !== NULL) {
587 587
             self::setDocumentCache($location, $instance);
588 588
         }
589 589
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
         } else {
625 625
             $physicalPage = 0;
626 626
             foreach ($this->physicalStructureInfo as $page) {
627
-                if (strpos($page['orderlabel'], $logicalPage) !== false) {
627
+                if (strpos($page['orderlabel'], $logicalPage) !== FALSE) {
628 628
                     $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
629 629
                     $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
630 630
                     return $physicalPage;
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
                 if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) {
662 662
                     // Get full text file.
663 663
                     $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext]));
664
-                    if ($fileContent !== false) {
664
+                    if ($fileContent !== FALSE) {
665 665
                         $textFormat = $this->getTextFormat($fileContent);
666 666
                     } else {
667 667
                         $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
     {
734 734
         $xml = Helper::getXmlFileAsString($fileContent);
735 735
 
736
-        if ($xml !== false) {
736
+        if ($xml !== FALSE) {
737 737
             // Get the root element's name as text format.
738 738
             return strtoupper($xml->getName());
739 739
         } else {
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
      *
754 754
      * @return string The title of the document itself or a parent document
755 755
      */
756
-    public static function getTitle(int $uid, bool $recursive = false): string
756
+    public static function getTitle(int $uid, bool $recursive = FALSE): string
757 757
     {
758 758
         $title = '';
759 759
         // Sanitize input.
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                     && (int) $partof
788 788
                     && $partof != $uid
789 789
                 ) {
790
-                    $title = self::getTitle($partof, true);
790
+                    $title = self::getTitle($partof, TRUE);
791 791
                 }
792 792
             } else {
793 793
                 Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
@@ -845,12 +845,12 @@  discard block
 block discarded – undo
845 845
                 return $depth;
846 846
             } elseif (array_key_exists('children', $element)) {
847 847
                 $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId);
848
-                if ($foundInChildren !== false) {
848
+                if ($foundInChildren !== FALSE) {
849 849
                     return $foundInChildren;
850 850
                 }
851 851
             }
852 852
         }
853
-        return false;
853
+        return FALSE;
854 854
     }
855 855
 
856 856
     /**
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
         } else {
886 886
             $this->logger->error('Invalid file location "' . $location . '" for document loading');
887 887
         }
888
-        return false;
888
+        return FALSE;
889 889
     }
890 890
 
891 891
     /**
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
                     'class' => $resArray['class']
924 924
                 ];
925 925
             }
926
-            $this->formatsLoaded = true;
926
+            $this->formatsLoaded = TRUE;
927 927
         }
928 928
     }
929 929
 
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
         ) {
1045 1045
             $this->prepareMetadataArray($cPid);
1046 1046
             $this->metadataArray[0] = $cPid;
1047
-            $this->metadataArrayLoaded = true;
1047
+            $this->metadataArrayLoaded = TRUE;
1048 1048
         }
1049 1049
         return $this->metadataArray;
1050 1050
     }
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
                 $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]);
1144 1144
                 $this->rootId = $parent->rootId;
1145 1145
             }
1146
-            $this->rootIdLoaded = true;
1146
+            $this->rootIdLoaded = TRUE;
1147 1147
         }
1148 1148
         return $this->rootId;
1149 1149
     }
@@ -1160,8 +1160,8 @@  discard block
 block discarded – undo
1160 1160
         // Is there no logical structure array yet?
1161 1161
         if (!$this->tableOfContentsLoaded) {
1162 1162
             // Get all logical structures.
1163
-            $this->getLogicalStructure('', true);
1164
-            $this->tableOfContentsLoaded = true;
1163
+            $this->getLogicalStructure('', TRUE);
1164
+            $this->tableOfContentsLoaded = TRUE;
1165 1165
         }
1166 1166
         return $this->tableOfContents;
1167 1167
     }
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
             || !method_exists($this, $method)
1219 1219
         ) {
1220 1220
             $this->logger->warning('There is no getter function for property "' . $var . '"');
1221
-            return null;
1221
+            return NULL;
1222 1222
         } else {
1223 1223
             return $this->$method();
1224 1224
         }
Please login to merge, or discard this patch.
Classes/Command/ReindexCommand.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
  *
31 31
  * @access public
32 32
  */
33
-class ReindexCommand extends BaseCommand
34
-{
33
+class ReindexCommand extends BaseCommand {
35 34
     /**
36 35
      * Configure the command by defining the name, options and arguments
37 36
      *
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $this->initializeRepositories((int) $input->getOption('pid'));
115 115
 
116 116
         if ($this->storagePid == 0) {
117
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
117
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
118 118
             return BaseCommand::FAILURE;
119 119
         }
120 120
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
130 130
                 $outputSolrCores = [];
131 131
                 foreach ($allSolrCores as $indexName => $uid) {
132
-                    $outputSolrCores[] = $uid . ' : ' . $indexName;
132
+                    $outputSolrCores[] = $uid.' : '.$indexName;
133 133
                 }
134 134
                 if (empty($outputSolrCores)) {
135
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
135
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
136 136
                     return BaseCommand::FAILURE;
137 137
                 } else {
138
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n");
138
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n");
139 139
                     return BaseCommand::FAILURE;
140 140
                 }
141 141
             }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                     ->setLimit((int) $input->getOption('index-limit'))
166 166
                     ->setOffset((int) $input->getOption('index-begin'))
167 167
                     ->execute();
168
-                $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.');
168
+                $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.');
169 169
             } else {
170 170
                 // Get all documents.
171 171
                 $documents = $this->documentRepository->findAll();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             ) {
188 188
                 $documents = $this->documentRepository->findAllByCollectionsLimited($collections, (int) $input->getOption('index-limit'), (int) $input->getOption('index-begin'));
189 189
 
190
-                $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.');
190
+                $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.');
191 191
             } else {
192 192
                 // Get all documents of given collections.
193 193
                 $documents = $this->documentRepository->findAllByCollectionsLimited($collections, 0);
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
             $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
202 202
 
203 203
             if ($doc === null) {
204
-                $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.');
204
+                $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.');
205 205
                 continue;
206 206
             }
207 207
 
208 208
             if ($dryRun) {
209
-                $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . '  with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
209
+                $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).'  with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
210 210
             } else {
211 211
                 if ($io->isVerbose()) {
212
-                    $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
212
+                    $io->writeln(date('Y-m-d H:i:s').' Indexing '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
213 213
                 }
214 214
                 $document->setCurrentDocument($doc);
215 215
                 // save to database
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             ->setHelp('')
47 47
             ->addOption(
48 48
                 'dry-run',
49
-                null,
49
+                NULL,
50 50
                 InputOption::VALUE_NONE,
51 51
                 'If this option is set, the files will not actually be processed but the location URI is shown.'
52 52
             )
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             )
95 95
             ->addOption(
96 96
                 'softCommit',
97
-                null,
97
+                NULL,
98 98
                 InputOption::VALUE_NONE,
99 99
                 'If this option is set, documents are just added to the index with a soft commit.'
100 100
             );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     protected function execute(InputInterface $input, OutputInterface $output): int
114 114
     {
115
-        $dryRun = $input->getOption('dry-run') != false ? true : false;
115
+        $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE;
116 116
 
117 117
         $io = new SymfonyStyle($input, $output);
118 118
         $io->title($this->getDescription());
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner'));
158 158
             }
159 159
         } else {
160
-            $this->owner = null;
160
+            $this->owner = NULL;
161 161
         }
162 162
 
163 163
         if (!empty($input->getOption('all'))) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             !empty($input->getOption('coll'))
181 181
             && !is_array($input->getOption('coll'))
182 182
         ) {
183
-            $collections = GeneralUtility::intExplode(',', $input->getOption('coll'), true);
183
+            $collections = GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE);
184 184
             // "coll" may be a single integer or a comma-separated list of integers.
185 185
             if (empty(array_filter($collections))) {
186 186
                 $io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.');
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
         }
205 205
 
206 206
         foreach ($documents as $id => $document) {
207
-            $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
207
+            $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE);
208 208
 
209
-            if ($doc === null) {
209
+            if ($doc === NULL) {
210 210
                 $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.');
211 211
                 continue;
212 212
             }
Please login to merge, or discard this patch.
Classes/Command/BaseCommand.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      *
335 335
      * @return void
336 336
      */
337
-    private function addCollections(Document &$document, array $collections): void
337
+    private function addCollections(Document & $document, array $collections): void
338 338
     {
339 339
         foreach ($collections as $collection) {
340 340
             $documentCollection = $this->collectionRepository->findOneByIndexName($collection);
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 
377 377
         for ($i = 0; $i < $count; $i++) {
378 378
             // Build the next part to add
379
-            $nextPart = ($i === 0 ? '' : $delimiter) . $metadataAuthor[$i];
379
+            $nextPart = ($i === 0 ? '' : $delimiter).$metadataAuthor[$i];
380 380
             // Check if adding this part and ellipsis in future would exceed the character limit
381
-            if (strlen($authors . $nextPart . $delimiter . $ellipsis) > 255) {
381
+            if (strlen($authors.$nextPart.$delimiter.$ellipsis) > 255) {
382 382
                 // Add ellipsis and stop adding more authors
383
-                $authors .= $delimiter . $ellipsis;
383
+                $authors .= $delimiter.$ellipsis;
384 384
                 break;
385 385
             }
386 386
             // Add the part to the main string
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
  *
41 41
  * @access public
42 42
  */
43
-class BaseCommand extends Command
44
-{
43
+class BaseCommand extends Command {
45 44
     /**
46 45
      * @access protected
47 46
      * @var CollectionRepository
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
      *
200 200
      * @return bool true on success, false otherwise
201 201
      */
202
-    protected function saveToDatabase(Document $document, bool $softCommit = false): bool
202
+    protected function saveToDatabase(Document $document, bool $softCommit = FALSE): bool
203 203
     {
204 204
         $doc = $document->getCurrentDocument();
205
-        if ($doc === null) {
206
-            return false;
205
+        if ($doc === NULL) {
206
+            return FALSE;
207 207
         }
208 208
 
209 209
         $doc->cPid = $this->storagePid;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                 $document->setPartof($this->getParentDocumentUidForSaving($document, $softCommit));
260 260
             }
261 261
 
262
-            if ($document->getUid() === null) {
262
+            if ($document->getUid() === NULL) {
263 263
                 // new document
264 264
                 $this->documentRepository->add($document);
265 265
             } else {
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 
270 270
             $this->persistenceManager->persistAll();
271 271
 
272
-            return true;
272
+            return TRUE;
273 273
         }
274 274
 
275
-        return false;
275
+        return FALSE;
276 276
     }
277 277
 
278 278
     /**
@@ -286,18 +286,18 @@  discard block
 block discarded – undo
286 286
      *
287 287
      * @return int The parent document's id.
288 288
      */
289
-    protected function getParentDocumentUidForSaving(Document $document, bool $softCommit = false): int
289
+    protected function getParentDocumentUidForSaving(Document $document, bool $softCommit = FALSE): int
290 290
     {
291 291
         $doc = $document->getCurrentDocument();
292 292
 
293
-        if ($doc !== null && !empty($doc->parentHref)) {
293
+        if ($doc !== NULL && !empty($doc->parentHref)) {
294 294
             // find document object by record_id of parent
295 295
             $parent = AbstractDocument::getInstance($doc->parentHref, ['storagePid' => $this->storagePid]);
296 296
 
297 297
             if ($parent->recordId) {
298 298
                 $parentDocument = $this->documentRepository->findOneByRecordId($parent->recordId);
299 299
 
300
-                if ($parentDocument === null) {
300
+                if ($parentDocument === NULL) {
301 301
                     // create new Document object
302 302
                     $parentDocument = GeneralUtility::makeInstance(Document::class);
303 303
                 }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
                 $success = $this->saveToDatabase($parentDocument, $softCommit);
311 311
 
312
-                if ($success === true) {
312
+                if ($success === TRUE) {
313 313
                     // add to index
314 314
                     Indexer::add($parentDocument, $this->documentRepository, $softCommit);
315 315
                     return $parentDocument->getUid();
Please login to merge, or discard this patch.
Classes/Command/HarvestCommand.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@
 block discarded – undo
33 33
  *
34 34
  * @access public
35 35
  */
36
-class HarvestCommand extends BaseCommand
37
-{
36
+class HarvestCommand extends BaseCommand {
38 37
     /**
39 38
      * Configure the command by defining the name, options and arguments
40 39
      *
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $this->initializeRepositories((int) $input->getOption('pid'));
112 112
 
113 113
         if ($this->storagePid == 0) {
114
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
114
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
115 115
             return BaseCommand::FAILURE;
116 116
         }
117 117
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
130 130
                 $outputSolrCores = [];
131 131
                 foreach ($allSolrCores as $indexName => $uid) {
132
-                    $outputSolrCores[] = $uid . ' : ' . $indexName;
132
+                    $outputSolrCores[] = $uid.' : '.$indexName;
133 133
                 }
134 134
                 if (empty($outputSolrCores)) {
135
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
135
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
136 136
                     return BaseCommand::FAILURE;
137 137
                 } else {
138
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n");
138
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n");
139 139
                     return BaseCommand::FAILURE;
140 140
                 }
141 141
             }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             return BaseCommand::FAILURE;
156 156
         }
157 157
         if (!GeneralUtility::isValidUrl($baseUrl)) {
158
-            $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").');
158
+            $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").');
159 159
             return BaseCommand::FAILURE;
160 160
         } else {
161 161
             try {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 }
198 198
             }
199 199
             if (empty($set)) {
200
-                $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").');
200
+                $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").');
201 201
                 return BaseCommand::FAILURE;
202 202
             }
203 203
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         }
216 216
 
217 217
         // Process all identifiers.
218
-        $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?');
218
+        $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?');
219 219
         foreach ($identifiers as $identifier) {
220 220
             // Build OAI GetRecord URL...
221 221
             $params = [
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
                 'metadataPrefix' => 'mets',
224 224
                 'identifier' => (string) $identifier->identifier
225 225
             ];
226
-            $docLocation = $baseLocation . http_build_query($params);
226
+            $docLocation = $baseLocation.http_build_query($params);
227 227
             // ...index the document...
228 228
             $document = null;
229 229
             $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true);
230 230
 
231 231
             if ($doc === null) {
232
-                $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.');
232
+                $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.');
233 233
                 continue;
234 234
             }
235 235
 
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
             $document->setSolrcore($solrCoreUid);
247 247
 
248 248
             if ($dryRun) {
249
-                $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
249
+                $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
250 250
             } else {
251 251
                 if ($io->isVerbose()) {
252
-                    $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
252
+                    $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
253 253
                 }
254 254
                 $document->setCurrentDocument($doc);
255 255
                 // save to database
@@ -276,6 +276,6 @@  discard block
 block discarded – undo
276 276
      */
277 277
     protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io): void
278 278
     {
279
-        $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n    " . $exception->getMessage());
279
+        $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n    ".$exception->getMessage());
280 280
     }
281 281
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             ->setHelp('')
50 50
             ->addOption(
51 51
                 'dry-run',
52
-                null,
52
+                NULL,
53 53
                 InputOption::VALUE_NONE,
54 54
                 'If this option is set, the files will not actually be processed but the location URIs are shown.'
55 55
             )
@@ -73,25 +73,25 @@  discard block
 block discarded – undo
73 73
             )
74 74
             ->addOption(
75 75
                 'from',
76
-                null,
76
+                NULL,
77 77
                 InputOption::VALUE_OPTIONAL,
78 78
                 'Datestamp (YYYY-MM-DD) to begin harvesting from.'
79 79
             )
80 80
             ->addOption(
81 81
                 'until',
82
-                null,
82
+                NULL,
83 83
                 InputOption::VALUE_OPTIONAL,
84 84
                 'Datestamp (YYYY-MM-DD) to end harvesting on.'
85 85
             )
86 86
             ->addOption(
87 87
                 'set',
88
-                null,
88
+                NULL,
89 89
                 InputOption::VALUE_OPTIONAL,
90 90
                 'Name of the set to limit harvesting to.'
91 91
             )
92 92
             ->addOption(
93 93
                 'softCommit',
94
-                null,
94
+                NULL,
95 95
                 InputOption::VALUE_NONE,
96 96
                 'If this option is set, documents are just added to the index by a soft commit.'
97 97
             );
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     protected function execute(InputInterface $input, OutputInterface $output): int
111 111
     {
112
-        $dryRun = $input->getOption('dry-run') != false ? true : false;
112
+        $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE;
113 113
 
114 114
         $io = new SymfonyStyle($input, $output);
115 115
         $io->title($this->getDescription());
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         ) {
178 178
             $from = new \DateTime($input->getOption('from'));
179 179
         } else {
180
-            $from = null;
180
+            $from = NULL;
181 181
         }
182 182
 
183 183
         if (
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
         ) {
187 187
             $until = new \DateTime($input->getOption('until'));
188 188
         } else {
189
-            $until = null;
189
+            $until = NULL;
190 190
         }
191 191
 
192
-        $set = null;
192
+        $set = NULL;
193 193
         if (
194 194
             !is_array($input->getOption('set'))
195 195
             && !empty($input->getOption('set'))
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
             ];
232 232
             $docLocation = $baseLocation . http_build_query($params);
233 233
             // ...index the document...
234
-            $document = null;
235
-            $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true);
234
+            $document = NULL;
235
+            $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], TRUE);
236 236
 
237
-            if ($doc === null) {
237
+            if ($doc === NULL) {
238 238
                 $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.');
239 239
                 continue;
240 240
             }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
                 $document = $this->documentRepository->findOneByRecordId($doc->recordId);
244 244
             }
245 245
 
246
-            if ($document === null) {
246
+            if ($document === NULL) {
247 247
                 // create new Document object
248 248
                 $document = GeneralUtility::makeInstance(Document::class);
249 249
             }
Please login to merge, or discard this patch.
Classes/Command/IndexCommand.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
  *
32 32
  * @access public
33 33
  */
34
-class IndexCommand extends BaseCommand
35
-{
34
+class IndexCommand extends BaseCommand {
36 35
 
37 36
     /**
38 37
      * Configure the command by defining the name, options and arguments
Please login to merge, or discard this patch.
Upper-Lower-Casing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             ->setHelp('')
49 49
             ->addOption(
50 50
                 'dry-run',
51
-                null,
51
+                NULL,
52 52
                 InputOption::VALUE_NONE,
53 53
                 'If this option is set, the files will not actually be processed but the location URI is shown.'
54 54
             )
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             )
79 79
             ->addOption(
80 80
                 'softCommit',
81
-                null,
81
+                NULL,
82 82
                 InputOption::VALUE_NONE,
83 83
                 'If this option is set, documents are just added to the index by a soft commit.'
84 84
             );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected function execute(InputInterface $input, OutputInterface $output): int
98 98
     {
99
-        $dryRun = $input->getOption('dry-run') != false ? true : false;
99
+        $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE;
100 100
 
101 101
         $io = new SymfonyStyle($input, $output);
102 102
         $io->title($this->getDescription());
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
                 $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner'));
154 154
             }
155 155
         } else {
156
-            $this->owner = null;
156
+            $this->owner = NULL;
157 157
         }
158 158
 
159
-        $document = null;
160
-        $doc = null;
159
+        $document = NULL;
160
+        $doc = NULL;
161 161
 
162 162
         // Try to find existing document in database
163 163
         if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) {
164 164
 
165 165
             $document = $this->documentRepository->findByUid($input->getOption('doc'));
166 166
 
167
-            if ($document === null) {
167
+            if ($document === NULL) {
168 168
                 $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
169 169
                 return BaseCommand::FAILURE;
170 170
             } else {
171
-                $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
171
+                $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE);
172 172
             }
173 173
 
174 174
         } else if (GeneralUtility::isValidUrl($input->getOption('doc'))) {
175
-            $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true);
175
+            $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE);
176 176
 
177 177
             $document = $this->getDocumentFromUrl($doc, $input->getOption('doc'));
178 178
         }
179 179
 
180
-        if ($doc === null) {
180
+        if ($doc === NULL) {
181 181
             $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.');
182 182
             return BaseCommand::FAILURE;
183 183
         }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     private function getDocumentFromUrl($doc, string $url): Document
231 231
     {
232
-        $document = null;
232
+        $document = NULL;
233 233
 
234 234
         if ($doc->recordId) {
235 235
             $document = $this->documentRepository->findOneByRecordId($doc->recordId);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             $document = $this->documentRepository->findOneByLocation($url);
238 238
         }
239 239
 
240
-        if ($document === null) {
240
+        if ($document === NULL) {
241 241
             // create new Document object
242 242
             $document = GeneralUtility::makeInstance(Document::class);
243 243
         }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $this->initializeRepositories((int) $input->getOption('pid'));
105 105
 
106 106
         if ($this->storagePid == 0) {
107
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
107
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
108 108
             return BaseCommand::FAILURE;
109 109
         }
110 110
 
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
120 120
                 $outputSolrCores = [];
121 121
                 foreach ($allSolrCores as $indexName => $uid) {
122
-                    $outputSolrCores[] = $uid . ' : ' . $indexName;
122
+                    $outputSolrCores[] = $uid.' : '.$indexName;
123 123
                 }
124 124
                 if (empty($outputSolrCores)) {
125
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
125
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
126 126
                     return BaseCommand::FAILURE;
127 127
                 } else {
128
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n");
128
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n");
129 129
                     return BaseCommand::FAILURE;
130 130
                 }
131 131
             }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             $document = $this->documentRepository->findByUid($input->getOption('doc'));
166 166
 
167 167
             if ($document === null) {
168
-                $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
168
+                $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .');
169 169
                 return BaseCommand::FAILURE;
170 170
             } else {
171 171
                 $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
@@ -178,31 +178,31 @@  discard block
 block discarded – undo
178 178
         }
179 179
 
180 180
         if ($doc === null) {
181
-            $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.');
181
+            $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.');
182 182
             return BaseCommand::FAILURE;
183 183
         }
184 184
 
185 185
         $document->setSolrcore($solrCoreUid);
186 186
 
187 187
         if ($dryRun) {
188
-            $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
188
+            $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
189 189
             $io->success('All done!');
190 190
             return BaseCommand::SUCCESS;
191 191
         } else {
192 192
             $document->setCurrentDocument($doc);
193 193
 
194 194
             if ($io->isVerbose()) {
195
-                $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.');
195
+                $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.');
196 196
             }
197 197
             $isSaved = $this->saveToDatabase($document, $input->getOption('softCommit'));
198 198
 
199 199
             if ($isSaved) {
200 200
                 if ($io->isVerbose()) {
201
-                    $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on Solr core ' . $solrCoreUid . '.');
201
+                    $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on Solr core '.$solrCoreUid.'.');
202 202
                 }
203 203
                 $isSaved = Indexer::add($document, $this->documentRepository, $input->getOption('softCommit'));
204 204
             } else {
205
-                $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on PID ' . $this->storagePid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['general']['requiredMetadataFields'] . ') in this document.');
205
+                $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on PID '.$this->storagePid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['general']['requiredMetadataFields'].') in this document.');
206 206
                 return BaseCommand::FAILURE;
207 207
             }
208 208
 
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
                 return BaseCommand::SUCCESS;
212 212
             }
213 213
 
214
-            $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on Solr core ' . $solrCoreUid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['general']['requiredMetadataFields'] . ') in this document.');
215
-            $io->info('INFO: Document with UID "' . $document->getUid() . '" is already in database. If you want to keep the database and index consistent you need to remove it.');
214
+            $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on Solr core '.$solrCoreUid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['general']['requiredMetadataFields'].') in this document.');
215
+            $io->info('INFO: Document with UID "'.$document->getUid().'" is already in database. If you want to keep the database and index consistent you need to remove it.');
216 216
             return BaseCommand::FAILURE;
217 217
         }
218 218
     }
Please login to merge, or discard this patch.
Classes/Domain/Repository/StructureRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class StructureRepository extends Repository
26
-{
25
+class StructureRepository extends Repository {
27 26
 
28 27
 }
Please login to merge, or discard this patch.