Passed
Pull Request — master (#113)
by
unknown
03:39
created
Classes/Hooks/ThumbnailCustomElement.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters']
23 23
         $result = $this->initializeResultArray();
24 24
         if (!empty($this->data['databaseRow']['thumbnail'])) {
25
-            $result['html'] = '<img alt="Thumbnail" title="" src="' . $this->data['databaseRow']['thumbnail'] . '" />';
25
+            $result['html'] = '<img alt="Thumbnail" title="" src="'.$this->data['databaseRow']['thumbnail'].'" />';
26 26
         } else {
27 27
             $result['html'] = '';
28 28
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,10 +14,8 @@
 block discarded – undo
14 14
 
15 15
 use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
16 16
 
17
-class ThumbnailCustomElement extends AbstractFormElement
18
-{
19
-    public function render()
20
-    {
17
+class ThumbnailCustomElement extends AbstractFormElement {
18
+    public function render() {
21 19
         // Custom TCA properties and other data can be found in $this->data, for example the above
22 20
         // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters']
23 21
         $result = $this->initializeResultArray();
Please login to merge, or discard this patch.
Classes/Hooks/ConfigurationForm.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
  * @subpackage dlf
30 30
  * @access public
31 31
  */
32
-class ConfigurationForm
33
-{
32
+class ConfigurationForm {
34 33
 
35 34
     /**
36 35
      * Check if a connection to a Solr server could be established with the given credentials.
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
      *
40 39
      * @return string Message informing the user of success or failure
41 40
      */
42
-    public function checkSolrConnection()
43
-    {
41
+    public function checkSolrConnection() {
44 42
         $solr = Solr::getInstance();
45 43
         if ($solr->ready) {
46 44
             Helper::addMessage(
@@ -65,8 +63,7 @@  discard block
 block discarded – undo
65 63
      *
66 64
      * @return void
67 65
      */
68
-    public function __construct()
69
-    {
66
+    public function __construct() {
70 67
         // Load backend localization file.
71 68
         Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf');
72 69
     }
Please login to merge, or discard this patch.
Classes/Domain/Model/Document.php 2 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @var \Kitodo\Dlf\Common\Doc|null
42 42
      */
43
-    protected $doc = null;
43
+    protected $doc = NULL;
44 44
 
45 45
     /**
46 46
      * @var string
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection>
157 157
      * @Extbase\ORM\Lazy
158 158
      */
159
-    protected $collections = null;
159
+    protected $collections = NULL;
160 160
 
161 161
     /**
162 162
      * @var string
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -192,14 +192,12 @@  discard block
 block discarded – undo
192 192
     /**
193 193
      * constructor
194 194
      */
195
-    public function __construct()
196
-    {
195
+    public function __construct() {
197 196
         // Do not remove the next line: It would break the functionality
198 197
         $this->initStorageObjects();
199 198
     }
200 199
 
201
-    protected function initStorageObjects()
202
-    {
200
+    protected function initStorageObjects() {
203 201
         $this->collections = new ObjectStorage();
204 202
     }
205 203
 
@@ -577,8 +575,7 @@  discard block
 block discarded – undo
577 575
      *
578 576
      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections
579 577
      */
580
-    public function getCollections()
581
-    {
578
+    public function getCollections() {
582 579
         return $this->collections;
583 580
     }
584 581
 
@@ -607,8 +604,7 @@  discard block
 block discarded – undo
607 604
      *
608 605
      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> collections
609 606
      */
610
-    public function removeCollection(Collection $collection)
611
-    {
607
+    public function removeCollection(Collection $collection) {
612 608
         $this->collections->detach($collection);
613 609
     }
614 610
 
Please login to merge, or discard this patch.
Classes/Domain/Model/Collection.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
      *
62 62
      * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
63 63
      */
64
-    protected $thumbnail = null;
64
+    protected $thumbnail = NULL;
65 65
 
66 66
     /**
67 67
      * @var int
Please login to merge, or discard this patch.
Classes/Domain/Repository/DocumentRepository.php 4 patches
Upper-Lower-Casing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function findOneByParameters($parameters)
52 52
     {
53
-        $doc = null;
54
-        $document = null;
53
+        $doc = NULL;
54
+        $document = NULL;
55 55
 
56 56
         if (isset($parameters['id']) && MathUtility::canBeInterpretedAsInteger($parameters['id'])) {
57 57
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
         } else if (isset($parameters['location']) && GeneralUtility::isValidUrl($parameters['location'])) {
65 65
 
66
-            $doc = Doc::getInstance($parameters['location'], [], true);
66
+            $doc = Doc::getInstance($parameters['location'], [], TRUE);
67 67
 
68 68
             if ($doc->recordId) {
69 69
                 $document = $this->findOneByRecordId($doc->recordId);
70 70
             }
71 71
 
72
-            if ($document === null) {
72
+            if ($document === NULL) {
73 73
                 // create new (dummy) Document object
74 74
                 $document = GeneralUtility::makeInstance(Document::class);
75 75
                 $document->setLocation($parameters['location']);
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 
78 78
         }
79 79
 
80
-        if ($document !== null && $doc === null) {
81
-            $doc = Doc::getInstance($document->getLocation(), [], true);
80
+        if ($document !== NULL && $doc === NULL) {
81
+            $doc = Doc::getInstance($document->getLocation(), [], TRUE);
82 82
         }
83 83
 
84
-        if ($doc !== null) {
84
+        if ($doc !== NULL) {
85 85
             $document->setDoc($doc);
86 86
         }
87 87
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         }
168 168
 
169 169
         if (isset($settings['excludeOther']) && (int) $settings['excludeOther'] === 0) {
170
-            $query->getQuerySettings()->setRespectStoragePage(false);
170
+            $query->getQuerySettings()->setRespectStoragePage(FALSE);
171 171
         }
172 172
 
173 173
         if (count($constraints)) {
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
557 557
      * @return array
558 558
      */
559
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
559
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = NULL)
560 560
     {
561 561
         // set settings global inside this repository
562 562
         $this->settings = $settings;
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
             if (!empty($searchParams['query'])) {
578 578
                 $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')';
579 579
             }
580
-            $params['fulltext'] = true;
580
+            $params['fulltext'] = TRUE;
581 581
         } else {
582 582
             // Retain given search field if valid.
583 583
             if (!empty($searchParams['query'])) {
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         }
671 671
 
672 672
         // Perform search.
673
-        $result = $this->searchSolr($params, true);
673
+        $result = $this->searchSolr($params, TRUE);
674 674
 
675 675
         // Initialize values
676 676
         $numberOfToplevels = 0;
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
                     $documents[$doc['uid']] = $allDocuments[$doc['uid']];
694 694
                 }
695 695
                 if ($documents[$doc['uid']]) {
696
-                    if ($doc['toplevel'] === false) {
696
+                    if ($doc['toplevel'] === FALSE) {
697 697
                         // this maybe a chapter, article, ..., year
698 698
                         if ($doc['type'] === 'year') {
699 699
                             continue;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
                             }
719 719
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
720 720
                         }
721
-                    } else if ($doc['toplevel'] === true) {
721
+                    } else if ($doc['toplevel'] === TRUE) {
722 722
                         $numberOfToplevels++;
723 723
                         foreach ($params['listMetadataRecords'] as $indexName => $solrField) {
724 724
                             if (isset($doc['metadata'][$indexName])) {
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         $params['filterquery'][] = ['query' => 'toplevel:true'];
796 796
 
797 797
         // Perform search.
798
-        $result = $this->searchSolr($params, true);
798
+        $result = $this->searchSolr($params, TRUE);
799 799
 
800 800
         if ($result['numFound'] > 0) {
801 801
             // There is only one result found because of toplevel:true.
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
      *
817 817
      * @return array The Apache Solr Documents that were fetched
818 818
      */
819
-    protected function searchSolr($parameters = [], $enableCache = true)
819
+    protected function searchSolr($parameters = [], $enableCache = TRUE)
820 820
     {
821 821
         // Set additional query parameters.
822 822
         $parameters['start'] = 0;
@@ -833,27 +833,27 @@  discard block
 block discarded – undo
833 833
         }
834 834
 
835 835
         $cacheIdentifier = '';
836
-        $cache = null;
836
+        $cache = NULL;
837 837
         // Calculate cache identifier.
838
-        if ($enableCache === true) {
839
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
838
+        if ($enableCache === TRUE) {
839
+            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE));
840 840
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
841 841
         }
842 842
         $resultSet = [
843 843
             'documents' => [],
844 844
             'numFound' => 0,
845 845
         ];
846
-        if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) {
846
+        if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) {
847 847
             $selectQuery = $solr->service->createSelect($parameters);
848 848
 
849
-            if ($parameters['fulltext'] === true) {
849
+            if ($parameters['fulltext'] === TRUE) {
850 850
                 // get highlighting component and apply settings
851 851
                 $selectQuery->getHighlighting();
852 852
             }
853 853
 
854 854
             $solrRequest = $solr->service->createRequest($selectQuery);
855 855
 
856
-            if ($parameters['fulltext'] === true) {
856
+            if ($parameters['fulltext'] === TRUE) {
857 857
                 // If it is a fulltext search, enable highlighting.
858 858
                 // field for which highlighting is going to be performed,
859 859
                 // is required if you want to have OCR highlighting
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
             /** @scrutinizer ignore-call */
874 874
             $resultSet['numFound'] = $result->getNumFound();
875 875
             $highlighting = [];
876
-            if ($parameters['fulltext'] === true) {
876
+            if ($parameters['fulltext'] === TRUE) {
877 877
                 $data = $result->getData();
878 878
                 $highlighting = $data['ocrHighlighting'];
879 879
             }
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
             }
903 903
 
904 904
             // Save value in cache.
905
-            if (!empty($resultSet) && $enableCache === true) {
905
+            if (!empty($resultSet) && $enableCache === TRUE) {
906 906
                 $cache->set($cacheIdentifier, $resultSet);
907 907
             }
908 908
         } else {
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,6 @@
 block discarded – undo
210 210
      * Volumes are documents that are both
211 211
      *  a) "leaf" elements i.e. partof != 0
212 212
      *  b) "root" elements that are not referenced by other documents ("root" elements that have no descendants)
213
-
214 213
      * @param array $settings
215 214
      *
216 215
      * @return array
Please login to merge, or discard this patch.
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @return \Kitodo\Dlf\Domain\Model\Document|null
52 52
      */
53
-    public function findOneByParameters($parameters)
54
-    {
53
+    public function findOneByParameters($parameters) {
55 54
         $doc = null;
56 55
         $document = null;
57 56
 
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
      *
96 95
      * @return \Kitodo\Dlf\Domain\Model\Document|null
97 96
      */
98
-    public function findOldestDocument()
99
-    {
97
+    public function findOldestDocument() {
100 98
         $query = $this->createQuery();
101 99
 
102 100
         $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]);
@@ -110,8 +108,7 @@  discard block
 block discarded – undo
110 108
      * @param  \Kitodo\Dlf\Domain\Model\Structure $structure
111 109
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
112 110
      */
113
-    public function getChildrenOfYearAnchor($partOf, $structure)
114
-    {
111
+    public function getChildrenOfYearAnchor($partOf, $structure) {
115 112
         $query = $this->createQuery();
116 113
 
117 114
         $query->matching($query->equals('structure', $structure));
@@ -132,8 +129,7 @@  discard block
 block discarded – undo
132 129
      *
133 130
      * @return \Kitodo\Dlf\Domain\Model\Document|null
134 131
      */
135
-    public function findOneByIdAndSettings($uid, $settings = [])
136
-    {
132
+    public function findOneByIdAndSettings($uid, $settings = []) {
137 133
         $settings = ['documentSets' => $uid];
138 134
 
139 135
         return $this->findDocumentsBySettings($settings)->getFirst();
@@ -146,8 +142,7 @@  discard block
 block discarded – undo
146 142
      *
147 143
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
148 144
      */
149
-    public function findDocumentsBySettings($settings = [])
150
-    {
145
+    public function findDocumentsBySettings($settings = []) {
151 146
         $query = $this->createQuery();
152 147
 
153 148
         $constraints = [];
@@ -177,8 +172,7 @@  discard block
 block discarded – undo
177 172
      *
178 173
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
179 174
      */
180
-    public function findAllByCollectionsLimited($collections, $limit = 50)
181
-    {
175
+    public function findAllByCollectionsLimited($collections, $limit = 50) {
182 176
         $query = $this->createQuery();
183 177
 
184 178
         // order by start_date -> start_time...
@@ -215,8 +209,7 @@  discard block
 block discarded – undo
215 209
      *
216 210
      * @return array
217 211
      */
218
-    public function getStatisticsForSelectedCollection($settings)
219
-    {
212
+    public function getStatisticsForSelectedCollection($settings) {
220 213
         if ($settings['collections']) {
221 214
             // Include only selected collections.
222 215
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -350,8 +343,7 @@  discard block
 block discarded – undo
350 343
      *
351 344
      * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
352 345
      */
353
-    public function getTableOfContentsFromDb($uid, $pid, $settings)
354
-    {
346
+    public function getTableOfContentsFromDb($uid, $pid, $settings) {
355 347
         // Build table of contents from database.
356 348
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
357 349
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -399,8 +391,7 @@  discard block
 block discarded – undo
399 391
      *
400 392
      * @return array The found document object
401 393
      */
402
-    public function getOaiRecord($settings, $parameters)
403
-    {
394
+    public function getOaiRecord($settings, $parameters) {
404 395
         $where = '';
405 396
 
406 397
         if (!$settings['show_userdefined']) {
@@ -440,8 +431,7 @@  discard block
 block discarded – undo
440 431
      *
441 432
      * @return array The found document objects
442 433
      */
443
-    public function getOaiDocumentList($settings, $documentsToProcess)
444
-    {
434
+    public function getOaiDocumentList($settings, $documentsToProcess) {
445 435
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
446 436
             ->getConnectionForTable('tx_dlf_documents');
447 437
 
@@ -475,8 +465,7 @@  discard block
 block discarded – undo
475 465
      *
476 466
      * @return array
477 467
      */
478
-    private function findAllByUids($uids)
479
-    {
468
+    private function findAllByUids($uids) {
480 469
         // get all documents from db we are talking about
481 470
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
482 471
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents');
@@ -520,8 +509,7 @@  discard block
 block discarded – undo
520 509
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
521 510
      * @return array
522 511
      */
523
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
524
-    {
512
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) {
525 513
         // set settings global inside this repository
526 514
         $this->settings = $settings;
527 515
 
@@ -730,8 +718,7 @@  discard block
 block discarded – undo
730 718
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
731 719
      * @return array
732 720
      */
733
-    protected function fetchMetadataFromSolr($uid, $listedMetadata = [])
734
-    {
721
+    protected function fetchMetadataFromSolr($uid, $listedMetadata = []) {
735 722
         // Prepare query parameters.
736 723
         $params = [];
737 724
         $metadataArray = [];
@@ -780,8 +767,7 @@  discard block
 block discarded – undo
780 767
      *
781 768
      * @return array The Apache Solr Documents that were fetched
782 769
      */
783
-    protected function searchSolr($parameters = [], $enableCache = true)
784
-    {
770
+    protected function searchSolr($parameters = [], $enableCache = true) {
785 771
         // Set additional query parameters.
786 772
         $parameters['start'] = 0;
787 773
         // Set query.
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
         $excludeOtherWhere = '';
360 360
         if ($settings['excludeOther']) {
361
-            $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['storagePid']);
361
+            $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['storagePid']);
362 362
         }
363 363
         // Check if there are any metadata to suggest.
364 364
         $result = $queryBuilder
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
411 411
             ->getConnectionForTable('tx_dlf_documents');
412 412
 
413
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
414
-            'FROM `tx_dlf_documents` ' .
415
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
416
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
417
-            'WHERE `tx_dlf_documents`.`record_id` = ? ' .
418
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
413
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
414
+            'FROM `tx_dlf_documents` '.
415
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
416
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
417
+            'WHERE `tx_dlf_documents`.`record_id` = ? '.
418
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
419 419
             $where;
420 420
 
421 421
         $values = [
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
446 446
             ->getConnectionForTable('tx_dlf_documents');
447 447
 
448
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
449
-            'FROM `tx_dlf_documents` ' .
450
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
451
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
452
-            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' .
453
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
454
-            'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' .
448
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
449
+            'FROM `tx_dlf_documents` '.
450
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
451
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
452
+            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '.
453
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
454
+            'AND '.Helper::whereExpression('tx_dlf_collections').' '.
455 455
             'GROUP BY `tx_dlf_documents`.`uid` ';
456 456
 
457 457
         $values = [
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
         // Set search query.
534 534
         if (
535 535
             (!empty($searchParams['fulltext']))
536
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches)
536
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches)
537 537
         ) {
538 538
             // If the query already is a fulltext query e.g using the facets
539 539
             $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1];
540 540
             // Search in fulltext field if applicable. Query must not be empty!
541 541
             if (!empty($searchParams['query'])) {
542
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')';
542
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')';
543 543
             }
544 544
             $params['fulltext'] = true;
545 545
         } else {
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
                         in_array($searchParams['extOperator'][$i], $allowedOperators)
563 563
                     ) {
564 564
                         if (!empty($query)) {
565
-                            $query .= ' ' . $searchParams['extOperator'][$i] . ' ';
565
+                            $query .= ' '.$searchParams['extOperator'][$i].' ';
566 566
                         }
567
-                        $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')';
567
+                        $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')';
568 568
                     }
569 569
                 }
570 570
             }
@@ -584,22 +584,22 @@  discard block
 block discarded – undo
584 584
         ) {
585 585
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
586 586
             $params['filterquery'][]['query'] = '_query_:"{!join from='
587
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
588
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
589
-                . $fields['uid'] . ':' . $searchParams['documentId'] . '"' . ' OR {!join from='
590
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
591
-                . $fields['uid'] . ':' . $searchParams['documentId'] . ' OR '
592
-                . $fields['uid'] . ':' . $searchParams['documentId'];
587
+                . $fields['uid'].' to='.$fields['partof'].'}'
588
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
589
+                . $fields['uid'].':'.$searchParams['documentId'].'"'.' OR {!join from='
590
+                . $fields['uid'].' to='.$fields['partof'].'}'
591
+                . $fields['uid'].':'.$searchParams['documentId'].' OR '
592
+                . $fields['uid'].':'.$searchParams['documentId'];
593 593
         }
594 594
 
595 595
         // if a collection is given, we prepare the collection query string
596 596
         if ($collection) {
597 597
             if ($collection instanceof \Kitodo\Dlf\Domain\Model\Collection) {
598
-                $collectionsQueryString = '"' . $collection->getIndexName() . '"';
598
+                $collectionsQueryString = '"'.$collection->getIndexName().'"';
599 599
             } else {
600 600
                 $collectionsQueryString = '';
601 601
                 foreach ($collection as $index => $collectionEntry) {
602
-                    $collectionsQueryString .= ($index > 0 ? ' OR ' : '') . '"' . $collectionEntry->getIndexName() . '"';
602
+                    $collectionsQueryString .= ($index > 0 ? ' OR ' : '').'"'.$collectionEntry->getIndexName().'"';
603 603
                 }
604 604
             }
605 605
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                 $params['filterquery'][]['query'] = 'toplevel:true';
608 608
                 $params['filterquery'][]['query'] = 'partof:0';
609 609
             }
610
-            $params['filterquery'][]['query'] = 'collection_faceting:(' . $collectionsQueryString . ')';
610
+            $params['filterquery'][]['query'] = 'collection_faceting:('.$collectionsQueryString.')';
611 611
         }
612 612
 
613 613
         // Set some query parameters.
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
         if ($listedMetadata) {
637 637
             foreach ($listedMetadata as $metadata) {
638 638
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
639
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
640
-                    $params['fields'] .= ',' . $listMetadataRecord;
639
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
640
+                    $params['fields'] .= ','.$listMetadataRecord;
641 641
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
642 642
                 }
643 643
             }
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
                     if (empty($documents[$doc['uid']]['title']) && ($documents[$doc['uid']]['partOf'] > 0)) {
724 724
                         $parentDocument = $this->findByUid($documents[$doc['uid']]['partOf']);
725 725
                         if ($parentDocument) {
726
-                            $documents[$doc['uid']]['title'] = '[' . $parentDocument->getTitle() . ']';
726
+                            $documents[$doc['uid']]['title'] = '['.$parentDocument->getTitle().']';
727 727
                         }
728 728
                     }
729 729
                 }
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         $metadataArray = [];
748 748
 
749 749
         // Set some query parameters.
750
-        $params['query'] = 'uid:' . $uid;
750
+        $params['query'] = 'uid:'.$uid;
751 751
         $params['start'] = 0;
752 752
         $params['rows'] = 1;
753 753
         $params['sort'] = ['score' => 'desc'];
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
         if ($listedMetadata) {
760 760
             foreach ($listedMetadata as $metadata) {
761 761
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
762
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
763
-                    $params['fields'] .= ',' . $listMetadataRecord;
762
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
763
+                    $params['fields'] .= ','.$listMetadataRecord;
764 764
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
765 765
                 }
766 766
             }
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
         $cache = null;
811 811
         // Calculate cache identifier.
812 812
         if ($enableCache === true) {
813
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
813
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
814 814
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
815 815
         }
816 816
         $resultSet = [
Please login to merge, or discard this patch.
Classes/Domain/Repository/MetadataRepository.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
         // order by oai_name
49 49
         $query->setOrderings(
50
-            array('sorting' => QueryInterface::ORDER_ASCENDING)
50
+            array ('sorting' => QueryInterface::ORDER_ASCENDING)
51 51
         );
52 52
 
53 53
         return $query->execute();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
      *
26 26
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
27 27
      */
28
-    public function findBySettings($settings = [])
29
-    {
28
+    public function findBySettings($settings = []) {
30 29
         $query = $this->createQuery();
31 30
 
32 31
         $constraints = [];
Please login to merge, or discard this patch.
Classes/Domain/Repository/CollectionRepository.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 
99 99
         // order by oai_name
100 100
         $query->setOrderings(
101
-            array('oai_name' => QueryInterface::ORDER_ASCENDING)
101
+            array ('oai_name' => QueryInterface::ORDER_ASCENDING)
102 102
         );
103 103
 
104 104
         return $query->execute();
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
37 37
      */
38
-    public function findAllByUids($uids)
39
-    {
38
+    public function findAllByUids($uids) {
40 39
         $query = $this->createQuery();
41 40
 
42 41
         $constraints = [];
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
         return $query->execute();
50 49
     }
51 50
 
52
-    public function getCollectionForMetadata($pages)
53
-    {
51
+    public function getCollectionForMetadata($pages) {
54 52
         // Get list of collections to show.
55 53
         $query = $this->createQuery();
56 54
 
@@ -66,8 +64,7 @@  discard block
 block discarded – undo
66 64
      *
67 65
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
68 66
      */
69
-    public function findCollectionsBySettings($settings = [])
70
-    {
67
+    public function findCollectionsBySettings($settings = []) {
71 68
         $query = $this->createQuery();
72 69
 
73 70
         $constraints = [];
@@ -104,8 +101,7 @@  discard block
 block discarded – undo
104 101
         return $query->execute();
105 102
     }
106 103
 
107
-    public function getIndexNameForSolr($settings, $set)
108
-    {
104
+    public function getIndexNameForSolr($settings, $set) {
109 105
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
110 106
             ->getQueryBuilderForTable('tx_dlf_collections');
111 107
 
Please login to merge, or discard this patch.
Classes/ExpressionLanguage/DocumentTypeFunctionProvider.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 if ($this->document) {
158 158
                     $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true);
159 159
                 } else {
160
-                    $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading');
160
+                    $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading');
161 161
                 }
162 162
             } else if (GeneralUtility::isValidUrl($requestData['id'])) {
163 163
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
                     $this->document->setLocation($requestData['id']);
177 177
                 } else {
178
-                    $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading');
178
+                    $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading');
179 179
                 }
180 180
             }
181 181
 
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
                 if ($this->document !== null && $doc !== null) {
193 193
                     $this->document->setDoc($doc);
194 194
                 } else {
195
-                    $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"');
195
+                    $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"');
196 196
                 }
197 197
             }
198 198
         } else {
199
-            $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading');
199
+            $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading');
200 200
         }
201 201
     }
202 202
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * @return ExpressionFunction[] An array of Function instances
43 43
      */
44
-    public function getFunctions()
45
-    {
44
+    public function getFunctions() {
46 45
         return [
47 46
             $this->getDocumentTypeFunction(),
48 47
         ];
@@ -68,8 +67,7 @@  discard block
 block discarded – undo
68 67
      *
69 68
      * @return void
70 69
      */
71
-    protected function initializeRepositories($storagePid)
72
-    {
70
+    protected function initializeRepositories($storagePid) {
73 71
         Helper::polyfillExtbaseClassesForTYPO3v9();
74 72
 
75 73
         // TODO: When we drop support for TYPO3v9, we needn't/shouldn't use ObjectManager anymore
@@ -92,12 +90,10 @@  discard block
 block discarded – undo
92 90
     {
93 91
         return new ExpressionFunction(
94 92
             'getDocumentType',
95
-            function()
96
-            {
93
+            function() {
97 94
                 // Not implemented, we only use the evaluator
98 95
             },
99
-            function($arguments, $cPid)
100
-            {
96
+            function($arguments, $cPid) {
101 97
                 /** @var RequestWrapper $requestWrapper */
102 98
                 $requestWrapper = $arguments['request'];
103 99
                 $queryParams = $requestWrapper->getQueryParams();
@@ -143,8 +139,7 @@  discard block
 block discarded – undo
143 139
      *
144 140
      * @return void
145 141
      */
146
-    protected function loadDocument($requestData, int $pid)
147
-    {
142
+    protected function loadDocument($requestData, int $pid) {
148 143
         // Try to get document format from database
149 144
         if (!empty($requestData['id'])) {
150 145
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
                 // Load document with current plugin parameters.
114 114
                 $this->loadDocument($queryParams['tx_dlf'], $cPid);
115
-                if ($this->document === null) {
115
+                if ($this->document === NULL) {
116 116
                     return $type;
117 117
                 }
118 118
                 // Set PID for metadata definitions.
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                     // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types.
124 124
                     if (
125 125
                         $this->document->getDoc() instanceof IiifManifest
126
-                        && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false
126
+                        && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE
127 127
                     ) {
128 128
                         return $type;
129 129
                     }
@@ -150,25 +150,25 @@  discard block
 block discarded – undo
150 150
 
151 151
             $this->initializeRepositories($pid);
152 152
 
153
-            $doc = null;
153
+            $doc = NULL;
154 154
             if (MathUtility::canBeInterpretedAsInteger($requestData['id'])) {
155 155
                 // find document from repository by uid
156 156
                 $this->document = $this->documentRepository->findOneByIdAndSettings((int) $requestData['id'], ['storagePid' => $pid]);
157 157
                 if ($this->document) {
158
-                    $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true);
158
+                    $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE);
159 159
                 } else {
160 160
                     $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading');
161 161
                 }
162 162
             } else if (GeneralUtility::isValidUrl($requestData['id'])) {
163 163
 
164
-                $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], true);
164
+                $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], TRUE);
165 165
 
166
-                if ($doc !== null) {
166
+                if ($doc !== NULL) {
167 167
                     if ($doc->recordId) {
168 168
                         $this->document = $this->documentRepository->findOneByRecordId($doc->recordId);
169 169
                     }
170 170
 
171
-                    if ($this->document === null) {
171
+                    if ($this->document === NULL) {
172 172
                         // create new dummy Document object
173 173
                         $this->document = GeneralUtility::makeInstance(Document::class);
174 174
                     }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                 }
180 180
             }
181 181
 
182
-            if ($this->document !== null && $doc !== null) {
182
+            if ($this->document !== NULL && $doc !== NULL) {
183 183
                 $this->document->setDoc($doc);
184 184
             }
185 185
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 
188 188
             $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']);
189 189
 
190
-            if ($this->document !== null) {
191
-                $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true);
192
-                if ($this->document !== null && $doc !== null) {
190
+            if ($this->document !== NULL) {
191
+                $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE);
192
+                if ($this->document !== NULL && $doc !== NULL) {
193 193
                     $this->document->setDoc($doc);
194 194
                 } else {
195 195
                     $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"');
Please login to merge, or discard this patch.
Classes/Common/Solr.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         // Get next available core name if none given.
136 136
         if (empty($core)) {
137
-            $core = 'dlfCore' . self::getNextCoreNumber();
137
+            $core = 'dlfCore'.self::getNextCoreNumber();
138 138
         }
139 139
         // Get Solr service instance.
140 140
         $solr = self::getInstance($core);
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
                 ->execute();
231 231
 
232 232
             while ($resArray = $result->fetch()) {
233
-                $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i';
233
+                $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i';
234 234
             }
235 235
 
236 236
             // Check if queried field is valid.
237 237
             $splitQuery = explode(':', $query, 2);
238 238
             if (in_array($splitQuery[0], $fields)) {
239
-                $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')';
239
+                $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')';
240 240
             } else {
241 241
                 $query = self::escapeQuery($query);
242 242
             }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     {
342 342
         $number = max(intval($number), 0);
343 343
         // Check if core already exists.
344
-        $solr = self::getInstance('dlfCore' . $number);
344
+        $solr = self::getInstance('dlfCore'.$number);
345 345
         if (!$solr->ready) {
346 346
             return $number;
347 347
         } else {
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         $parameters['start'] = 0;
404 404
         $parameters['rows'] = $this->limit;
405 405
         // Calculate cache identifier.
406
-        $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true));
406
+        $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true));
407 407
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
408 408
         $resultSet = [];
409 409
         if (($entry = $cache->get($cacheIdentifier)) === false) {
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
      */
535 535
     public function __get($var)
536 536
     {
537
-        $method = '_get' . ucfirst($var);
537
+        $method = '_get'.ucfirst($var);
538 538
         if (
539 539
             !property_exists($this, $var)
540 540
             || !method_exists($this, $method)
541 541
         ) {
542
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
542
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
543 543
             return;
544 544
         } else {
545 545
             return $this->$method();
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
      */
573 573
     public function __set($var, $value)
574 574
     {
575
-        $method = '_set' . ucfirst($var);
575
+        $method = '_set'.ucfirst($var);
576 576
         if (
577 577
             !property_exists($this, $var)
578 578
             || !method_exists($this, $method)
579 579
         ) {
580
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
580
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
581 581
         } else {
582 582
             $this->$method($value);
583 583
         }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
                     'scheme' => $this->config['scheme'],
615 615
                     'host' => $this->config['host'],
616 616
                     'port' => $this->config['port'],
617
-                    'path' => '/' . $this->config['path'],
617
+                    'path' => '/'.$this->config['path'],
618 618
                     'core' => $core,
619 619
                     'username' => $this->config['username'],
620 620
                     'password' => $this->config['password'],
Please login to merge, or discard this 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.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @var string|null
56 56
      * @access protected
57 57
      */
58
-    protected $core = null;
58
+    protected $core = NULL;
59 59
 
60 60
     /**
61 61
      * This holds the PID for the configuration
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @var bool
104 104
      * @access protected
105 105
      */
106
-    protected $ready = false;
106
+    protected $ready = FALSE;
107 107
 
108 108
     /**
109 109
      * This holds the singleton search objects with their core as array key
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return \Kitodo\Dlf\Common\Solr Instance of this class
298 298
      */
299
-    public static function getInstance($core = null)
299
+    public static function getInstance($core = NULL)
300 300
     {
301 301
         // Get core name if UID is given.
302 302
         if (MathUtility::canBeInterpretedAsInteger($core)) {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         // Check if core is set or null.
306 306
         if (
307 307
             empty($core)
308
-            && $core !== null
308
+            && $core !== NULL
309 309
         ) {
310 310
             Helper::log('Invalid core UID or name given for Apache Solr', LOG_SEVERITY_ERROR);
311 311
         }
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
         $parameters['start'] = 0;
404 404
         $parameters['rows'] = $this->limit;
405 405
         // Calculate cache identifier.
406
-        $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true));
406
+        $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE));
407 407
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
408 408
         $resultSet = [];
409
-        if (($entry = $cache->get($cacheIdentifier)) === false) {
409
+        if (($entry = $cache->get($cacheIdentifier)) === FALSE) {
410 410
             $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters));
411 411
             $result = $this->service->select($selectQuery);
412 412
             foreach ($result as $doc) {
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
         // Check if connection is established.
633 633
         $query = $this->service->createCoreAdmin();
634 634
         $action = $query->createStatus();
635
-        if ($core !== null) {
635
+        if ($core !== NULL) {
636 636
             $action->setCore($core);
637 637
         }
638 638
         $query->setAction($action);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             $response = $this->service->coreAdmin($query);
641 641
             if ($response->getWasSuccessful()) {
642 642
                 // Solr is reachable, but is the core as well?
643
-                if ($core !== null) {
643
+                if ($core !== NULL) {
644 644
                     $result = $response->getStatusResult();
645 645
                     if (
646 646
                         $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
                     }
655 655
                 }
656 656
                 // Instantiation successful!
657
-                $this->ready = true;
657
+                $this->ready = TRUE;
658 658
             }
659 659
         } catch (\Exception $e) {
660 660
             // Nothing to do here.
Please login to merge, or discard this patch.