Passed
Pull Request — master (#209)
by
unknown
10:39
created
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.
Classes/Domain/Repository/DocumentRepository.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             case Security::ROLE_RESEARCHER:
47 47
                 $query->matching(
48 48
                     $query->logicalAnd(
49
-                        array(
49
+                        array (
50 50
                             $query->equals('suggestion', true),
51 51
                             $query->equals('creator', $creatorUid)
52 52
                         )
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $query = $this->createQuery();
67 67
 
68
-        $constraints = array(
68
+        $constraints = array (
69 69
             $query->logicalNot($query->equals('object_identifier', '')),
70 70
             $query->logicalNot($query->equals('object_identifier', null))
71 71
         );
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         $result = $query->execute();
86 86
 
87
-        $objectIdentifiers = array();
87
+        $objectIdentifiers = array ();
88 88
 
89 89
         foreach ($result as $document) {
90 90
             $objectIdentifiers[$document->getObjectIdentifier()] = $document->getObjectIdentifier();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $query = $this->createQuery();
105 105
         $query->getQuerySettings()->setRespectStoragePage(false);
106 106
 
107
-        $constraints = array();
107
+        $constraints = array ();
108 108
         $constraints[] = $query->equals('process_number', '');
109 109
         $constraints[] = $query->equals('process_number', null);
110 110
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $dateTimeObj = new \DateTime();
134 134
         $dateTimeObj->sub(new \DateInterval("PT" . $timeout . "S"));
135 135
 
136
-        $constraints = array();
136
+        $constraints = array ();
137 137
         $constraints[] = $query->lessThan('tstamp', $dateTimeObj->getTimestamp());
138 138
 
139 139
         $query->matching(
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $dateTimeObj = new \DateTime();
160 160
         $dateTimeObj->sub(new \DateInterval("PT" . $timeout . "S"));
161 161
 
162
-        $constraints = array();
162
+        $constraints = array ();
163 163
         $constraints[] = $query->lessThan('tstamp', $dateTimeObj->getTimestamp());
164 164
 
165 165
         $query->matching(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $query = $this->createQuery();
183 183
 
184
-        $constraints = array(
184
+        $constraints = array (
185 185
             $query->equals('object_identifier', $objectIdentifier),
186 186
             $query->logicalNot($query->equals('temporary', true)),
187 187
             $query->logicalNot($query->equals('suggestion', true))
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             return null;
223 223
         }
224 224
 
225
-        $query->setOrderings(array("tstamp" => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING));
225
+        $query->setOrderings(array ("tstamp" => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING));
226 226
         $query->matching($query->logicalAnd($constraints));
227 227
 
228 228
         return $query->execute()->getFirst();
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         $query = $this->createQuery();
310 310
         $query->matching(
311 311
             $query->logicalAnd(
312
-                array(
312
+                array (
313 313
                     $query->logicalNot(
314 314
                         $query->equals('embargo_date', 0)
315 315
                     )
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                     $query->equals('suggestion', false)
348 348
                 );
349 349
 
350
-        $query->setOrderings(array("tstamp" => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING));
350
+        $query->setOrderings(array ("tstamp" => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING));
351 351
         $query->matching($query->logicalOr($constraints));
352 352
 
353 353
         return $query->execute();
Please login to merge, or discard this patch.