Passed
Pull Request — master (#209)
by
unknown
33:50 queued 24:56
created
Classes/Services/ElasticSearch/ElasticSearch.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             throw new ElasticSearchMissingIndexNameException('Missing search index name.');
83 83
         }
84 84
 
85
-        $hosts = array(
85
+        $hosts = array (
86 86
             $this->server . ':' . $this->port,
87 87
         );
88 88
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
             if ($notes && is_array($notes)) {
311 311
                 $data->notes = $notes;
312 312
             } else {
313
-                $data->notes = array();
313
+                $data->notes = array ();
314 314
             }
315 315
 
316 316
             $files = $document->getFile();
Please login to merge, or discard this patch.
Classes/Services/ElasticSearch/QueryBuilder.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $query = [
123 123
                 'bool' => [
124 124
                     'must' => [
125
-                        'match_all' => (object)[]
125
+                        'match_all' => (object) []
126 126
                     ],
127 127
                     'filter' => $queryFilter
128 128
                 ]
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
                             'script' => [
165 165
                                 'lang' => 'painless',
166 166
                                 'source' =>
167
-                                    "for (int i = 0; i < doc['collections'].length; ++i) {".
168
-                                    "    if(doc['collections'][i] =='".
169
-                                    $this->clientConfigurationManager->getUniversityCollection() ."') {".
170
-                                    "        return 'true';".
171
-                                    "    }".
172
-                                    "}".
167
+                                    "for (int i = 0; i < doc['collections'].length; ++i) {" .
168
+                                    "    if(doc['collections'][i] =='" .
169
+                                    $this->clientConfigurationManager->getUniversityCollection() . "') {" .
170
+                                    "        return 'true';" .
171
+                                    "    }" .
172
+                                    "}" .
173 173
                                     "return 'false';"
174 174
                             ]
175 175
                         ]
@@ -185,23 +185,23 @@  discard block
 block discarded – undo
185 185
                             'script' => [
186 186
                                 'lang' => 'painless',
187 187
                                 'source' =>
188
-                                    "if (".
189
-                                    "    doc['creator'].size() > 0 &&".
190
-                                    "    doc['creator'].value == '".$this->security->getUser()->getUid()."') {".
191
-                                    "    return 'self';".
192
-                                    "}".
193
-                                    "if (".
194
-                                    "    doc['creatorRole'].size() > 0 &&".
195
-                                    "    doc['creatorRole'].value == '".Security::ROLE_LIBRARIAN."'".
196
-                                    ") {".
197
-                                    "    return 'librarian';".
198
-                                    "}".
199
-                                    "if (".
200
-                                    "    doc['creatorRole'].size() > 0 &&".
201
-                                    "    doc['creatorRole'].value == '".Security::ROLE_RESEARCHER."'".
202
-                                    ") {".
203
-                                    "    return 'user';".
204
-                                    "}".
188
+                                    "if (" .
189
+                                    "    doc['creator'].size() > 0 &&" .
190
+                                    "    doc['creator'].value == '" . $this->security->getUser()->getUid() . "') {" .
191
+                                    "    return 'self';" .
192
+                                    "}" .
193
+                                    "if (" .
194
+                                    "    doc['creatorRole'].size() > 0 &&" .
195
+                                    "    doc['creatorRole'].value == '" . Security::ROLE_LIBRARIAN . "'" .
196
+                                    ") {" .
197
+                                    "    return 'librarian';" .
198
+                                    "}" .
199
+                                    "if (" .
200
+                                    "    doc['creatorRole'].size() > 0 &&" .
201
+                                    "    doc['creatorRole'].value == '" . Security::ROLE_RESEARCHER . "'" .
202
+                                    ") {" .
203
+                                    "    return 'user';" .
204
+                                    "}" .
205 205
                                     "return 'unknown';"
206 206
                             ]
207 207
                         ]
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
      */
415 415
     protected function buildSortQueryPart($sortField, $sortOrder) {
416 416
 
417
-        $sortField = ($sortField)? $sortField : 'title';
418
-        $sortOrder = ($sortOrder)? $sortOrder : 'asc';
417
+        $sortField = ($sortField) ? $sortField : 'title';
418
+        $sortOrder = ($sortOrder) ? $sortOrder : 'asc';
419 419
 
420 420
         // Build the sorting part.
421 421
         $script = "";
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
             ];
447 447
         } else {
448 448
             if ($sortField == 'title') {
449
-                $sortField.= ".keyword";
449
+                $sortField .= ".keyword";
450 450
             }
451 451
 
452 452
             if ($sortField == 'personsSort') {
453
-                $sortField.= ".keyword";
453
+                $sortField .= ".keyword";
454 454
             }
455 455
 
456 456
             $sort = [
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     protected function getSortScriptUniversityCollection($collection)
468 468
     {
469 469
         $script  = "for (int i = 0; i < doc['collections'].length; ++i) {";
470
-        $script .= "    if (doc['collections'][i] == '".$collection."') {";
470
+        $script .= "    if (doc['collections'][i] == '" . $collection . "') {";
471 471
         $script .= "        return '1';";
472 472
         $script .= "    }";
473 473
         $script .= "}";
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
 
489 489
     protected function getSortScriptCreatorRole($feUserUid)
490 490
     {
491
-        $script = "if (doc['creator'].value == '".$feUserUid."') {";
491
+        $script = "if (doc['creator'].value == '" . $feUserUid . "') {";
492 492
         $script .= "    return '1';";
493 493
         $script .= "}";
494
-        $script .= "if (doc['creatorRole'].value == '".Security::ROLE_LIBRARIAN."') {";
494
+        $script .= "if (doc['creatorRole'].value == '" . Security::ROLE_LIBRARIAN . "') {";
495 495
         $script .= "return '2';";
496 496
         $script .= "}";
497
-        $script .= "if (doc['creatorRole'].value == '".Security::ROLE_RESEARCHER."') {";
497
+        $script .= "if (doc['creatorRole'].value == '" . Security::ROLE_RESEARCHER . "') {";
498 498
         $script .= "    return '3';";
499 499
         $script .= "}";
500 500
         $script .= "return '4';";
@@ -509,15 +509,15 @@  discard block
 block discarded – undo
509 509
         foreach (DocumentWorkflow::PLACES as $state) {
510 510
             if (array_key_exists($state, DocumentWorkflow::STATE_TO_ALIASSTATE_MAPPING)) {
511 511
                 $aliasState = DocumentWorkflow::STATE_TO_ALIASSTATE_MAPPING[$state];
512
-                $key = 'LLL:EXT:dpf/Resources/Private/Language/locallang.xlf:manager.documentList.state.'.$aliasState;
512
+                $key = 'LLL:EXT:dpf/Resources/Private/Language/locallang.xlf:manager.documentList.state.' . $aliasState;
513 513
                 $stateName = LocalizationUtility::translate($key, 'dpf');
514
-                $sortStates[] = "if (doc['state'].value == '".$state."') return '".$stateName."';";
514
+                $sortStates[] = "if (doc['state'].value == '" . $state . "') return '" . $stateName . "';";
515 515
             }
516 516
         }
517 517
 
518 518
         $sortStates = implode(" ", $sortStates);
519 519
 
520
-        return $sortStates." return '';";
520
+        return $sortStates . " return '';";
521 521
     }
522 522
 
523 523
 
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
         $sortDoctypes = [];
527 527
         foreach ($this->documentTypeRepository->findAll() as $documentType) {
528 528
             if ($documentType->getName() && $documentType->getDisplayname()) {
529
-                $sortDoctypes[] = "if (doc['doctype'].value == '".$documentType->getName()."')"
530
-                    ." return '".$documentType->getDisplayname()."';";
529
+                $sortDoctypes[] = "if (doc['doctype'].value == '" . $documentType->getName() . "')"
530
+                    ." return '" . $documentType->getDisplayname() . "';";
531 531
             }
532 532
         }
533 533
 
534 534
         $sortDoctypes = implode(" ", $sortDoctypes);
535 535
 
536
-        return $sortDoctypes." return '';";
536
+        return $sortDoctypes . " return '';";
537 537
     }
538 538
 
539 539
 }
Please login to merge, or discard this patch.