Passed
Pull Request — master (#103)
by Alexander
03:37
created
Classes/Domain/Repository/BasketRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace Kitodo\Dlf\Domain\Repository;
14 14
 
15
-class BasketRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
16
-{
15
+class BasketRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
17 16
 
18 17
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/DocumentRepository.php 3 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
         $excludeOtherWhere = '';
396 396
         if ($settings['excludeOther']) {
397
-            $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['pages']);
397
+            $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['pages']);
398 398
         }
399 399
         // Check if there are any metadata to suggest.
400 400
         $result = $queryBuilder
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
447 447
             ->getConnectionForTable('tx_dlf_documents');
448 448
 
449
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
450
-            'FROM `tx_dlf_documents` ' .
451
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
452
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
453
-            'WHERE `tx_dlf_documents`.`record_id` = ? ' .
454
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
449
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
450
+            'FROM `tx_dlf_documents` '.
451
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
452
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
453
+            'WHERE `tx_dlf_documents`.`record_id` = ? '.
454
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
455 455
             $where;
456 456
 
457 457
         $values = [
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
482 482
             ->getConnectionForTable('tx_dlf_documents');
483 483
 
484
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
485
-            'FROM `tx_dlf_documents` ' .
486
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
487
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
488
-            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' .
489
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
490
-            'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' .
484
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
485
+            'FROM `tx_dlf_documents` '.
486
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
487
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
488
+            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '.
489
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
490
+            'AND '.Helper::whereExpression('tx_dlf_collections').' '.
491 491
             'GROUP BY `tx_dlf_documents`.`uid` ';
492 492
 
493 493
         $values = [
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
         // Set search query.
570 570
         if (
571 571
             (!empty($searchParams['fulltext']))
572
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches)
572
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches)
573 573
         ) {
574 574
             // If the query already is a fulltext query e.g using the facets
575 575
             $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1];
576 576
             // Search in fulltext field if applicable. Query must not be empty!
577 577
             if (!empty($searchParams['query'])) {
578
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')';
578
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')';
579 579
             }
580 580
             $params['fulltext'] = true;
581 581
         } else {
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
                         in_array($searchParams['extOperator'][$i], $allowedOperators)
599 599
                     ) {
600 600
                         if (!empty($query)) {
601
-                            $query .= ' ' . $searchParams['extOperator'][$i] . ' ';
601
+                            $query .= ' '.$searchParams['extOperator'][$i].' ';
602 602
                         }
603
-                        $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')';
603
+                        $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')';
604 604
                     }
605 605
                 }
606 606
             }
@@ -620,12 +620,12 @@  discard block
 block discarded – undo
620 620
         ) {
621 621
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
622 622
             $params['filterquery'][]['query'] = '_query_:"{!join from='
623
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
624
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
625
-                . $fields['uid'] . ':' . $searchParams['documentId'] . '"' . ' OR {!join from='
626
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
627
-                . $fields['uid'] . ':' . $searchParams['documentId'] . ' OR '
628
-                . $fields['uid'] . ':' . $searchParams['documentId'];
623
+                . $fields['uid'].' to='.$fields['partof'].'}'
624
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
625
+                . $fields['uid'].':'.$searchParams['documentId'].'"'.' OR {!join from='
626
+                . $fields['uid'].' to='.$fields['partof'].'}'
627
+                . $fields['uid'].':'.$searchParams['documentId'].' OR '
628
+                . $fields['uid'].':'.$searchParams['documentId'];
629 629
         }
630 630
 
631 631
         // if a collection is given, we prepare the collection query string
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
             $collecionsQueryString = $collection->getIndexName();
634 634
             $params['filterquery'][]['query'] = 'toplevel:true';
635 635
             $params['filterquery'][]['query'] = 'partof:0';
636
-            $params['filterquery'][]['query'] = 'collection_faceting:("' . $collecionsQueryString . '")';
636
+            $params['filterquery'][]['query'] = 'collection_faceting:("'.$collecionsQueryString.'")';
637 637
         }
638 638
 
639 639
         // Set some query parameters.
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
         if ($listedMetadata) {
663 663
             foreach ($listedMetadata as $metadata) {
664 664
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
665
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
666
-                    $params['fields'] .= ',' . $listMetadataRecord;
665
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
666
+                    $params['fields'] .= ','.$listMetadataRecord;
667 667
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
668 668
                 }
669 669
             }
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                     if (empty($documents[$doc['uid']]['title']) && ($documents[$doc['uid']]['partOf'] > 0)) {
750 750
                         $parentDocument = $this->findByUid($documents[$doc['uid']]['partOf']);
751 751
                         if ($parentDocument) {
752
-                            $documents[$doc['uid']]['title'] = '[' . $parentDocument->getTitle() . ']';
752
+                            $documents[$doc['uid']]['title'] = '['.$parentDocument->getTitle().']';
753 753
                         }
754 754
                     }
755 755
                 }
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
         $metadataArray = [];
774 774
 
775 775
         // Set some query parameters.
776
-        $params['query'] = 'uid:' . $uid;
776
+        $params['query'] = 'uid:'.$uid;
777 777
         $params['start'] = 0;
778 778
         $params['rows'] = 1;
779 779
         $params['sort'] = ['score' => 'desc'];
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
         if ($listedMetadata) {
786 786
             foreach ($listedMetadata as $metadata) {
787 787
                 if ($metadata->getIndexIndexed()) {
788
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . 'i';
789
-                    $params['fields'] .= ',' . $listMetadataRecord;
788
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').'i';
789
+                    $params['fields'] .= ','.$listMetadataRecord;
790 790
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
791 791
                 }
792 792
             }
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
         $cache = null;
837 837
         // Calculate cache identifier.
838 838
         if ($enableCache === true) {
839
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, 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 = [
Please login to merge, or discard this patch.
Braces   +19 added lines, -38 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
 use TYPO3\CMS\Core\Utility\MathUtility;
26 26
 use TYPO3\CMS\Extbase\Persistence\QueryInterface;
27 27
 
28
-class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
29
-{
28
+class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
30 29
     /**
31 30
      * The controller settings passed to the repository for some special actions.
32 31
      *
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      *
49 48
      * @return \Kitodo\Dlf\Domain\Model\Document|null
50 49
      */
51
-    public function findOneByParameters($parameters)
52
-    {
50
+    public function findOneByParameters($parameters) {
53 51
         $doc = null;
54 52
         $document = null;
55 53
 
@@ -90,8 +88,7 @@  discard block
 block discarded – undo
90 88
     }
91 89
 
92 90
 
93
-    public function findByUidAndPartOf($uid, $partOf)
94
-    {
91
+    public function findByUidAndPartOf($uid, $partOf) {
95 92
         $query = $this->createQuery();
96 93
 
97 94
         $query->matching($query->equals('uid', $uid));
@@ -105,8 +102,7 @@  discard block
 block discarded – undo
105 102
      *
106 103
      * @return \Kitodo\Dlf\Domain\Model\Document|null
107 104
      */
108
-    public function findOldestDocument()
109
-    {
105
+    public function findOldestDocument() {
110 106
         $query = $this->createQuery();
111 107
 
112 108
         $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]);
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
      * @param  \Kitodo\Dlf\Domain\Model\Structure $structure
121 117
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
122 118
      */
123
-    public function getChildrenOfYearAnchor($partOf, $structure)
124
-    {
119
+    public function getChildrenOfYearAnchor($partOf, $structure) {
125 120
         $query = $this->createQuery();
126 121
 
127 122
         $query->matching($query->equals('structure', $structure));
@@ -142,8 +137,7 @@  discard block
 block discarded – undo
142 137
      *
143 138
      * @return \Kitodo\Dlf\Domain\Model\Document|null
144 139
      */
145
-    public function findOneByIdAndSettings($uid, $settings = [])
146
-    {
140
+    public function findOneByIdAndSettings($uid, $settings = []) {
147 141
         $settings = ['documentSets' => $uid];
148 142
 
149 143
         return $this->findDocumentsBySettings($settings)->getFirst();
@@ -156,8 +150,7 @@  discard block
 block discarded – undo
156 150
      *
157 151
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
158 152
      */
159
-    public function findDocumentsBySettings($settings = [])
160
-    {
153
+    public function findDocumentsBySettings($settings = []) {
161 154
         $query = $this->createQuery();
162 155
 
163 156
         $constraints = [];
@@ -187,8 +180,7 @@  discard block
 block discarded – undo
187 180
      *
188 181
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
189 182
      */
190
-    public function findAllByCollectionsLimited($collections, $limit = 50)
191
-    {
183
+    public function findAllByCollectionsLimited($collections, $limit = 50) {
192 184
         $query = $this->createQuery();
193 185
 
194 186
         // order by start_date -> start_time...
@@ -223,8 +215,7 @@  discard block
 block discarded – undo
223 215
      *
224 216
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
225 217
      */
226
-    public function findAllTitles($settings = [])
227
-    {
218
+    public function findAllTitles($settings = []) {
228 219
         $query = $this->createQuery();
229 220
 
230 221
         $constraints = [];
@@ -252,8 +243,7 @@  discard block
 block discarded – undo
252 243
      *
253 244
      * @return int
254 245
      */
255
-    public function countAllTitles($settings = [])
256
-    {
246
+    public function countAllTitles($settings = []) {
257 247
         return $this->findAllTitles($settings)->count();
258 248
     }
259 249
 
@@ -266,8 +256,7 @@  discard block
 block discarded – undo
266 256
      *
267 257
      * @return int
268 258
      */
269
-    public function countAllVolumes($settings = [])
270
-    {
259
+    public function countAllVolumes($settings = []) {
271 260
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
272 261
             ->getQueryBuilderForTable('tx_dlf_documents');
273 262
         $subQueryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -295,8 +284,7 @@  discard block
 block discarded – undo
295 284
         return $countVolumes;
296 285
     }
297 286
 
298
-    public function getStatisticsForSelectedCollection($settings)
299
-    {
287
+    public function getStatisticsForSelectedCollection($settings) {
300 288
         // Include only selected collections.
301 289
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
302 290
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -386,8 +374,7 @@  discard block
 block discarded – undo
386 374
         return ['titles' => $countTitles, 'volumes' => $countVolumes];
387 375
     }
388 376
 
389
-    public function getTableOfContentsFromDb($uid, $pid, $settings)
390
-    {
377
+    public function getTableOfContentsFromDb($uid, $pid, $settings) {
391 378
         // Build table of contents from database.
392 379
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
393 380
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -435,8 +422,7 @@  discard block
 block discarded – undo
435 422
      *
436 423
      * @return array The found document object
437 424
      */
438
-    public function getOaiRecord($settings, $parameters)
439
-    {
425
+    public function getOaiRecord($settings, $parameters) {
440 426
         $where = '';
441 427
 
442 428
         if (!$settings['show_userdefined']) {
@@ -476,8 +462,7 @@  discard block
 block discarded – undo
476 462
      *
477 463
      * @return array The found document objects
478 464
      */
479
-    public function getOaiDocumentList($settings, $documentsToProcess)
480
-    {
465
+    public function getOaiDocumentList($settings, $documentsToProcess) {
481 466
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
482 467
             ->getConnectionForTable('tx_dlf_documents');
483 468
 
@@ -511,8 +496,7 @@  discard block
 block discarded – undo
511 496
      *
512 497
      * @return array
513 498
      */
514
-    private function findAllByUids($uids)
515
-    {
499
+    private function findAllByUids($uids) {
516 500
         // get all documents from db we are talking about
517 501
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
518 502
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents');
@@ -556,8 +540,7 @@  discard block
 block discarded – undo
556 540
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
557 541
      * @return array
558 542
      */
559
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
560
-    {
543
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) {
561 544
         // set settings global inside this repository
562 545
         $this->settings = $settings;
563 546
 
@@ -766,8 +749,7 @@  discard block
 block discarded – undo
766 749
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
767 750
      * @return array
768 751
      */
769
-    public function fetchMetadataFromSolr($uid, $listedMetadata = [])
770
-    {
752
+    public function fetchMetadataFromSolr($uid, $listedMetadata = []) {
771 753
         // Prepare query parameters.
772 754
         $params = [];
773 755
         $metadataArray = [];
@@ -816,8 +798,7 @@  discard block
 block discarded – undo
816 798
      *
817 799
      * @return array The Apache Solr Documents that were fetched
818 800
      */
819
-    protected function searchSolr($parameters = [], $enableCache = true)
820
-    {
801
+    protected function searchSolr($parameters = [], $enableCache = true) {
821 802
         // Set additional query parameters.
822 803
         $parameters['start'] = 0;
823 804
         // Set query.
Please login to merge, or discard this patch.
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.
Classes/Domain/Repository/ActionLogRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace Kitodo\Dlf\Domain\Repository;
14 14
 
15
-class ActionLogRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
16
-{
15
+class ActionLogRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
17 16
 
18 17
 }
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   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 use TYPO3\CMS\Core\Database\ConnectionPool;
17 17
 use TYPO3\CMS\Extbase\Persistence\QueryInterface;
18 18
 
19
-class MetadataRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
20
-{
19
+class MetadataRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
21 20
     /**
22 21
      * Finds all collection for the given settings
23 22
      *
@@ -25,8 +24,7 @@  discard block
 block discarded – undo
25 24
      *
26 25
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
27 26
      */
28
-    public function findBySettings($settings = [])
29
-    {
27
+    public function findBySettings($settings = []) {
30 28
         $query = $this->createQuery();
31 29
 
32 30
         $constraints = [];
Please login to merge, or discard this patch.
Classes/Domain/Repository/TokenRepository.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 use TYPO3\CMS\Core\Utility\GeneralUtility;
17 17
 
18 18
 
19
-class TokenRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
20
-{
19
+class TokenRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
21 20
     /**
22 21
      * Delete all expired token
23 22
      *
@@ -25,8 +24,7 @@  discard block
 block discarded – undo
25 24
      *
26 25
      * @return void
27 26
      */
28
-    public function deleteExpiredTokens($expireTime)
29
-    {
27
+    public function deleteExpiredTokens($expireTime) {
30 28
         $query = $this->createQuery();
31 29
 
32 30
         $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   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 use TYPO3\CMS\Core\Utility\GeneralUtility;
18 18
 use TYPO3\CMS\Extbase\Persistence\QueryInterface;
19 19
 
20
-class CollectionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
21
-{
20
+class CollectionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
22 21
     /**
23 22
      * Set the default ordering. This is applied to findAll(), too.
24 23
      *
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
      *
36 35
      * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
37 36
      */
38
-    public function findAllByUids($uids)
39
-    {
37
+    public function findAllByUids($uids) {
40 38
         $query = $this->createQuery();
41 39
 
42 40
         $constraints = [];
@@ -49,8 +47,7 @@  discard block
 block discarded – undo
49 47
         return $query->execute();
50 48
     }
51 49
 
52
-    public function getCollectionForMetadata($pages)
53
-    {
50
+    public function getCollectionForMetadata($pages) {
54 51
         // Get list of collections to show.
55 52
         $query = $this->createQuery();
56 53
 
@@ -66,8 +63,7 @@  discard block
 block discarded – undo
66 63
      *
67 64
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
68 65
      */
69
-    public function findCollectionsBySettings($settings = [])
70
-    {
66
+    public function findCollectionsBySettings($settings = []) {
71 67
         $query = $this->createQuery();
72 68
 
73 69
         $constraints = [];
@@ -104,8 +100,7 @@  discard block
 block discarded – undo
104 100
         return $query->execute();
105 101
     }
106 102
 
107
-    public function getIndexNameForSolr($settings, $set)
108
-    {
103
+    public function getIndexNameForSolr($settings, $set) {
109 104
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
110 105
             ->getQueryBuilderForTable('tx_dlf_collections');
111 106
 
Please login to merge, or discard this patch.
Classes/Domain/Repository/FormatRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace Kitodo\Dlf\Domain\Repository;
14 14
 
15
-class FormatRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
16
-{
15
+class FormatRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
17 16
 
18 17
 }
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.