Passed
Pull Request — master (#105)
by Alexander
05:13
created
Classes/Hooks/DataHandler.php 3 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
                     ) {
140 140
                         // Get current configuration.
141 141
                         $result = $queryBuilder
142
-                            ->select($table . '.is_listed AS is_listed')
142
+                            ->select($table.'.is_listed AS is_listed')
143 143
                             ->from($table)
144 144
                             ->where(
145
-                                $queryBuilder->expr()->eq($table . '.uid', intval($id)),
145
+                                $queryBuilder->expr()->eq($table.'.uid', intval($id)),
146 146
                                 Helper::whereExpression($table)
147 147
                             )
148 148
                             ->setMaxResults(1)
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
                     ) {
165 165
                         // Get current configuration.
166 166
                         $result = $queryBuilder
167
-                            ->select($table . '.index_autocomplete AS index_autocomplete')
167
+                            ->select($table.'.index_autocomplete AS index_autocomplete')
168 168
                             ->from($table)
169 169
                             ->where(
170
-                                $queryBuilder->expr()->eq($table . '.uid', intval($id)),
170
+                                $queryBuilder->expr()->eq($table.'.uid', intval($id)),
171 171
                                 Helper::whereExpression($table)
172 172
                             )
173 173
                             ->setMaxResults(1)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                                 if ($solr->ready) {
243 243
                                     // Delete Solr document.
244 244
                                     $updateQuery = $solr->service->createUpdate();
245
-                                    $updateQuery->addDeleteQuery('uid:' . $id);
245
+                                    $updateQuery->addDeleteQuery('uid:'.$id);
246 246
                                     $updateQuery->addCommit();
247 247
                                     $solr->service->update($updateQuery);
248 248
                                 }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                                     $document->setDoc($doc);
255 255
                                     Indexer::add($document);
256 256
                                 } else {
257
-                                    $this->logger->error('Failed to re-index document with UID ' . $id);
257
+                                    $this->logger->error('Failed to re-index document with UID '.$id);
258 258
                                 }
259 259
                             }
260 260
                         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                         if ($solr->ready) {
322 322
                             // Delete Solr document.
323 323
                             $updateQuery = $solr->service->createUpdate();
324
-                            $updateQuery->addDeleteQuery('uid:' . $id);
324
+                            $updateQuery->addDeleteQuery('uid:'.$id);
325 325
                             $updateQuery->addCommit();
326 326
                             $solr->service->update($updateQuery);
327 327
                             if ($command == 'delete') {
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
                             $document->setDoc($doc);
337 337
                             Indexer::add($document);
338 338
                         } else {
339
-                            $this->logger->error('Failed to re-index document with UID ' . $id);
339
+                            $this->logger->error('Failed to re-index document with UID '.$id);
340 340
                         }
341 341
                         break;
342 342
                 }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                             // Nothing to do here.
388 388
                         }
389 389
                     }
390
-                    $this->logger->warning('Core ' . $resArray['core'] . ' could not be deleted from Apache Solr');
390
+                    $this->logger->warning('Core '.$resArray['core'].' could not be deleted from Apache Solr');
391 391
                 }
392 392
             }
393 393
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  * @subpackage dlf
35 35
  * @access public
36 36
  */
37
-class DataHandler implements LoggerAwareInterface
38
-{
37
+class DataHandler implements LoggerAwareInterface {
39 38
     use LoggerAwareTrait;
40 39
 
41 40
     /**
@@ -43,8 +42,7 @@  discard block
 block discarded – undo
43 42
      */
44 43
     protected $documentRepository;
45 44
 
46
-    protected function getDocumentRepository()
47
-    {
45
+    protected function getDocumentRepository() {
48 46
         if ($this->documentRepository === null) {
49 47
             $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
50 48
             $this->documentRepository = $objectManager->get(DocumentRepository::class);
@@ -65,8 +63,7 @@  discard block
 block discarded – undo
65 63
      *
66 64
      * @return void
67 65
      */
68
-    public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray)
69
-    {
66
+    public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray) {
70 67
         if ($status == 'new') {
71 68
             switch ($table) {
72 69
                     // Field post-processing for table "tx_dlf_documents".
@@ -195,8 +192,7 @@  discard block
 block discarded – undo
195 192
      *
196 193
      * @return void
197 194
      */
198
-    public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray)
199
-    {
195
+    public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray) {
200 196
         if ($status == 'update') {
201 197
             switch ($table) {
202 198
                     // After database operations for table "tx_dlf_documents".
@@ -275,8 +271,7 @@  discard block
 block discarded – undo
275 271
      *
276 272
      * @return void
277 273
      */
278
-    public function processCmdmap_postProcess($command, $table, $id)
279
-    {
274
+    public function processCmdmap_postProcess($command, $table, $id) {
280 275
         if (
281 276
             in_array($command, ['move', 'delete', 'undelete'])
282 277
             && $table == 'tx_dlf_documents'
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     protected function getDocumentRepository()
47 47
     {
48
-        if ($this->documentRepository === null) {
48
+        if ($this->documentRepository === NULL) {
49 49
             $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
50 50
             $this->documentRepository = $objectManager->get(DocumentRepository::class);
51 51
         }
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
                             } else {
250 250
                                 // Reindex document.
251 251
                                 $document = $this->getDocumentRepository()->findByUid($id);
252
-                                $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $document->getPid()], true);
253
-                                if ($document !== null && $doc !== null) {
252
+                                $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $document->getPid()], TRUE);
253
+                                if ($document !== NULL && $doc !== NULL) {
254 254
                                     $document->setDoc($doc);
255 255
                                     Indexer::add($document);
256 256
                                 } else {
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
                     case 'undelete':
332 332
                         // Reindex document.
333 333
                         $document = $this->getDocumentRepository()->findByUid($id);
334
-                        $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $document->getPid()], true);
335
-                        if ($document !== null && $doc !== null) {
334
+                        $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $document->getPid()], TRUE);
335
+                        if ($document !== NULL && $doc !== NULL) {
336 336
                             $document->setDoc($doc);
337 337
                             Indexer::add($document);
338 338
                         } else {
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
                         $query = $solr->service->createCoreAdmin();
375 375
                         $action = $query->createUnload();
376 376
                         $action->setCore($resArray['core']);
377
-                        $action->setDeleteDataDir(true);
378
-                        $action->setDeleteIndex(true);
379
-                        $action->setDeleteInstanceDir(true);
377
+                        $action->setDeleteDataDir(TRUE);
378
+                        $action->setDeleteIndex(TRUE);
379
+                        $action->setDeleteInstanceDir(TRUE);
380 380
                         $query->setAction($action);
381 381
                         try {
382 382
                             $response = $solr->service->coreAdmin($query);
Please login to merge, or discard this patch.
Classes/Hooks/ItemsProcFunc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,8 +126,8 @@
 block discarded – undo
126 126
             ->select(...explode(',', $fields))
127 127
             ->from($table)
128 128
             ->where(
129
-                $queryBuilder->expr()->eq($table . '.pid', intval($this->storagePid)),
130
-                $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
129
+                $queryBuilder->expr()->eq($table.'.pid', intval($this->storagePid)),
130
+                $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
131 131
                 $andWhere
132 132
             )
133 133
             ->orderBy($sorting)
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage dlf
27 27
  * @access public
28 28
  */
29
-class ItemsProcFunc
30
-{
29
+class ItemsProcFunc {
31 30
     /**
32 31
      * @var int
33 32
      */
@@ -42,8 +41,7 @@  discard block
 block discarded – undo
42 41
      *
43 42
      * @return void
44 43
      */
45
-    public function toolList(&$params)
46
-    {
44
+    public function toolList(&$params) {
47 45
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) {
48 46
             $params['items'][] = [Helper::getLanguageService()->getLL($label), $class];
49 47
         }
@@ -56,8 +54,7 @@  discard block
 block discarded – undo
56 54
      *
57 55
      * @return void
58 56
      */
59
-    public function __construct()
60
-    {
57
+    public function __construct() {
61 58
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
62 59
         $configurationManager = $objectManager->get(ConfigurationManager::class);
63 60
         // we must get the storagePid from full TypoScript setup at this point.
@@ -74,8 +71,7 @@  discard block
 block discarded – undo
74 71
      *
75 72
      * @return void
76 73
      */
77
-    public function extendedSearchList(&$params)
78
-    {
74
+    public function extendedSearchList(&$params) {
79 75
         $this->generateList(
80 76
             $params,
81 77
             'label,index_name',
@@ -116,8 +112,7 @@  discard block
 block discarded – undo
116 112
      *
117 113
      * @return void
118 114
      */
119
-    protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '')
120
-    {
115
+    protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') {
121 116
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
122 117
             ->getQueryBuilderForTable($table);
123 118
 
Please login to merge, or discard this patch.
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 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.
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.
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return \Kitodo\Dlf\Domain\Model\Document|null
50 50
      */
51
-    public function findOneByParameters($parameters)
52
-    {
51
+    public function findOneByParameters($parameters) {
53 52
         $doc = null;
54 53
         $document = null;
55 54
 
@@ -90,8 +89,7 @@  discard block
 block discarded – undo
90 89
     }
91 90
 
92 91
 
93
-    public function findByUidAndPartOf($uid, $partOf)
94
-    {
92
+    public function findByUidAndPartOf($uid, $partOf) {
95 93
         $query = $this->createQuery();
96 94
 
97 95
         $query->matching($query->equals('uid', $uid));
@@ -105,8 +103,7 @@  discard block
 block discarded – undo
105 103
      *
106 104
      * @return \Kitodo\Dlf\Domain\Model\Document|null
107 105
      */
108
-    public function findOldestDocument()
109
-    {
106
+    public function findOldestDocument() {
110 107
         $query = $this->createQuery();
111 108
 
112 109
         $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]);
@@ -120,8 +117,7 @@  discard block
 block discarded – undo
120 117
      * @param  \Kitodo\Dlf\Domain\Model\Structure $structure
121 118
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
122 119
      */
123
-    public function getChildrenOfYearAnchor($partOf, $structure)
124
-    {
120
+    public function getChildrenOfYearAnchor($partOf, $structure) {
125 121
         $query = $this->createQuery();
126 122
 
127 123
         $query->matching($query->equals('structure', $structure));
@@ -142,8 +138,7 @@  discard block
 block discarded – undo
142 138
      *
143 139
      * @return \Kitodo\Dlf\Domain\Model\Document|null
144 140
      */
145
-    public function findOneByIdAndSettings($uid, $settings = [])
146
-    {
141
+    public function findOneByIdAndSettings($uid, $settings = []) {
147 142
         $settings = ['documentSets' => $uid];
148 143
 
149 144
         return $this->findDocumentsBySettings($settings)->getFirst();
@@ -156,8 +151,7 @@  discard block
 block discarded – undo
156 151
      *
157 152
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
158 153
      */
159
-    public function findDocumentsBySettings($settings = [])
160
-    {
154
+    public function findDocumentsBySettings($settings = []) {
161 155
         $query = $this->createQuery();
162 156
 
163 157
         $constraints = [];
@@ -187,8 +181,7 @@  discard block
 block discarded – undo
187 181
      *
188 182
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
189 183
      */
190
-    public function findAllByCollectionsLimited($collections, $limit = 50)
191
-    {
184
+    public function findAllByCollectionsLimited($collections, $limit = 50) {
192 185
         $query = $this->createQuery();
193 186
 
194 187
         // order by start_date -> start_time...
@@ -223,8 +216,7 @@  discard block
 block discarded – undo
223 216
      *
224 217
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
225 218
      */
226
-    public function findAllTitles($settings = [])
227
-    {
219
+    public function findAllTitles($settings = []) {
228 220
         $query = $this->createQuery();
229 221
 
230 222
         $constraints = [];
@@ -252,8 +244,7 @@  discard block
 block discarded – undo
252 244
      *
253 245
      * @return int
254 246
      */
255
-    public function countAllTitles($settings = [])
256
-    {
247
+    public function countAllTitles($settings = []) {
257 248
         return $this->findAllTitles($settings)->count();
258 249
     }
259 250
 
@@ -266,8 +257,7 @@  discard block
 block discarded – undo
266 257
      *
267 258
      * @return int
268 259
      */
269
-    public function countAllVolumes($settings = [])
270
-    {
260
+    public function countAllVolumes($settings = []) {
271 261
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
272 262
             ->getQueryBuilderForTable('tx_dlf_documents');
273 263
         $subQueryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -295,8 +285,7 @@  discard block
 block discarded – undo
295 285
         return $countVolumes;
296 286
     }
297 287
 
298
-    public function getStatisticsForSelectedCollection($settings)
299
-    {
288
+    public function getStatisticsForSelectedCollection($settings) {
300 289
         // Include only selected collections.
301 290
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
302 291
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -386,8 +375,7 @@  discard block
 block discarded – undo
386 375
         return ['titles' => $countTitles, 'volumes' => $countVolumes];
387 376
     }
388 377
 
389
-    public function getTableOfContentsFromDb($uid, $pid, $settings)
390
-    {
378
+    public function getTableOfContentsFromDb($uid, $pid, $settings) {
391 379
         // Build table of contents from database.
392 380
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
393 381
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -435,8 +423,7 @@  discard block
 block discarded – undo
435 423
      *
436 424
      * @return array The found document object
437 425
      */
438
-    public function getOaiRecord($settings, $parameters)
439
-    {
426
+    public function getOaiRecord($settings, $parameters) {
440 427
         $where = '';
441 428
 
442 429
         if (!$settings['show_userdefined']) {
@@ -476,8 +463,7 @@  discard block
 block discarded – undo
476 463
      *
477 464
      * @return array The found document objects
478 465
      */
479
-    public function getOaiDocumentList($settings, $documentsToProcess)
480
-    {
466
+    public function getOaiDocumentList($settings, $documentsToProcess) {
481 467
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
482 468
             ->getConnectionForTable('tx_dlf_documents');
483 469
 
@@ -511,8 +497,7 @@  discard block
 block discarded – undo
511 497
      *
512 498
      * @return array
513 499
      */
514
-    private function findAllByUids($uids)
515
-    {
500
+    private function findAllByUids($uids) {
516 501
         // get all documents from db we are talking about
517 502
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
518 503
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents');
@@ -556,8 +541,7 @@  discard block
 block discarded – undo
556 541
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
557 542
      * @return array
558 543
      */
559
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
560
-    {
544
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) {
561 545
         // set settings global inside this repository
562 546
         $this->settings = $settings;
563 547
 
@@ -766,8 +750,7 @@  discard block
 block discarded – undo
766 750
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
767 751
      * @return array
768 752
      */
769
-    public function fetchMetadataFromSolr($uid, $listedMetadata = [])
770
-    {
753
+    public function fetchMetadataFromSolr($uid, $listedMetadata = []) {
771 754
         // Prepare query parameters.
772 755
         $params = [];
773 756
         $metadataArray = [];
@@ -816,8 +799,7 @@  discard block
 block discarded – undo
816 799
      *
817 800
      * @return array The Apache Solr Documents that were fetched
818 801
      */
819
-    protected function searchSolr($parameters = [], $enableCache = true)
820
-    {
802
+    protected function searchSolr($parameters = [], $enableCache = true) {
821 803
         // Set additional query parameters.
822 804
         $parameters['start'] = 0;
823 805
         // Set query.
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.