Passed
Pull Request — master (#123)
by Sebastian
03:43
created
Classes/Controller/ListViewController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
         // extract collection(s) from collection parameter
76 76
         $collection = null;
77 77
         if ($this->searchParams['collection']) {
78
-            foreach(explode(',', $this->searchParams['collection']) as $collectionEntry) {
78
+            foreach (explode(',', $this->searchParams['collection']) as $collectionEntry) {
79 79
                 $collection[] = $this->collectionRepository->findByUid($collectionEntry);
80 80
             }
81 81
         }
Please login to merge, or discard this patch.
Classes/Common/SolrSearch.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             // in which case metadata of toplevel entry isn't yet filled.
99 99
             if (empty($document['metadata'])) {
100 100
                 $document['metadata'] = $this->fetchToplevelMetadataFromSolr([
101
-                    'query' => 'uid:' . $document['uid'],
101
+                    'query' => 'uid:'.$document['uid'],
102 102
                     'start' => 0,
103 103
                     'rows' => 1,
104 104
                     'sort' => ['score' => 'desc'],
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             if (empty($document['title']) && $document['partOf'] > 0) {
110 110
                 $superiorTitle = Doc::getTitle($document['partOf'], true);
111 111
                 if (!empty($superiorTitle)) {
112
-                    $document['title'] = '[' . $superiorTitle . ']';
112
+                    $document['title'] = '['.$superiorTitle.']';
113 113
                 }
114 114
             }
115 115
         }
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
         // Set search query.
173 173
         if (
174 174
             (!empty($this->searchParams['fulltext']))
175
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches)
175
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches)
176 176
         ) {
177 177
             // If the query already is a fulltext query e.g using the facets
178 178
             $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1];
179 179
             // Search in fulltext field if applicable. Query must not be empty!
180 180
             if (!empty($this->searchParams['query'])) {
181
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
181
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')';
182 182
             }
183 183
             $params['fulltext'] = true;
184 184
         } else {
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
                         in_array($this->searchParams['extOperator'][$i], $allowedOperators)
202 202
                     ) {
203 203
                         if (!empty($query)) {
204
-                            $query .= ' ' . $this->searchParams['extOperator'][$i] . ' ';
204
+                            $query .= ' '.$this->searchParams['extOperator'][$i].' ';
205 205
                         }
206
-                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')';
206
+                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')';
207 207
                     }
208 208
                 }
209 209
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         // Add filter query for date search
213 213
         if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
214 214
             // combine dateFrom and dateTo into range search
215
-            $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']';
215
+            $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']';
216 216
         }
217 217
 
218 218
         // Add filter query for faceting.
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
         ) {
230 230
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
231 231
             $params['filterquery'][]['query'] = '_query_:"{!join from='
232
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
233
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
234
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from='
235
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
236
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR '
237
-                . $fields['uid'] . ':' . $this->searchParams['documentId'];
232
+                . $fields['uid'].' to='.$fields['partof'].'}'
233
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
234
+                . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from='
235
+                . $fields['uid'].' to='.$fields['partof'].'}'
236
+                . $fields['uid'].':'.$this->searchParams['documentId'].' OR '
237
+                . $fields['uid'].':'.$this->searchParams['documentId'];
238 238
         }
239 239
 
240 240
         // if collections are given, we prepare the collection query string
@@ -243,25 +243,25 @@  discard block
 block discarded – undo
243 243
             $virtualCollectionsQueryString = '';
244 244
             foreach ($this->collection as $collectionEntry) {
245 245
                 // check for virtual collections query string
246
-                if($collectionEntry->getIndexSearch()) {
247
-                    $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR ('. $collectionEntry->getIndexSearch() . ')' ;
246
+                if ($collectionEntry->getIndexSearch()) {
247
+                    $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collectionEntry->getIndexSearch().')' : ' OR ('.$collectionEntry->getIndexSearch().')';
248 248
                 } else {
249
-                    $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"';
249
+                    $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collectionEntry->getIndexName().'"' : ' OR "'.$collectionEntry->getIndexName().'"';
250 250
                 }
251 251
             }
252 252
             
253 253
             // distinguish between simple collection browsing and actual searching within the collection(s)
254
-            if(!empty($collectionsQueryString)) {
255
-                if(empty($query)) {
256
-                    $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)';
254
+            if (!empty($collectionsQueryString)) {
255
+                if (empty($query)) {
256
+                    $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)';
257 257
                 } else {
258
-                    $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))';
258
+                    $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))';
259 259
                 }
260 260
             }
261 261
 
262 262
             // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separatly
263
-            if(!empty($virtualCollectionsQueryString)) {
264
-                $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')';
263
+            if (!empty($virtualCollectionsQueryString)) {
264
+                $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')';
265 265
             }
266 266
 
267 267
             // combine both querystrings into a single filterquery via OR if both are given, otherwise pass either of those
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
         if ($this->listedMetadata) {
295 295
             foreach ($this->listedMetadata as $metadata) {
296 296
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
297
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
298
-                    $params['fields'] .= ',' . $listMetadataRecord;
297
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
298
+                    $params['fields'] .= ','.$listMetadataRecord;
299 299
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
300 300
                 }
301 301
             }
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
                 }
340 340
                 if ($documents[$doc['uid']]) {
341 341
                     // translate language code if applicable
342
-                    if($doc['metadata']['language']) {
343
-                        foreach($doc['metadata']['language'] as $indexName => $language) {
342
+                    if ($doc['metadata']['language']) {
343
+                        foreach ($doc['metadata']['language'] as $indexName => $language) {
344 344
                             $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]);
345 345
                         }
346 346
                     }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                             $children = $childrenOf[$doc['uid']] ?? [];
380 380
                             if (!empty($children)) {
381 381
                                 $metadataOf = $this->fetchToplevelMetadataFromSolr([
382
-                                    'query' => 'partof:' . $doc['uid'],
382
+                                    'query' => 'partof:'.$doc['uid'],
383 383
                                     'start' => 0,
384 384
                                     'rows' => 100,
385 385
                                 ]);
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
         if ($this->listedMetadata) {
427 427
             foreach ($this->listedMetadata as $metadata) {
428 428
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
429
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
430
-                    $params['fields'] .= ',' . $listMetadataRecord;
429
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
430
+                    $params['fields'] .= ','.$listMetadataRecord;
431 431
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
432 432
                 }
433 433
             }
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 
441 441
         foreach ($result['documents'] as $doc) {
442 442
             // translate language code if applicable
443
-            if($doc['metadata']['language']) {
444
-                foreach($doc['metadata']['language'] as $indexName => $language) {
443
+            if ($doc['metadata']['language']) {
444
+                foreach ($doc['metadata']['language'] as $indexName => $language) {
445 445
                     $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]);
446 446
                 }
447 447
             }
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
         $cache = null;
484 484
         // Calculate cache identifier.
485 485
         if ($enableCache === true) {
486
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
486
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
487 487
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
488 488
         }
489 489
         $resultSet = [
Please login to merge, or discard this patch.
Classes/Controller/CalendarController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 foreach ($year['children'] as $month) {
128 128
                     foreach ($month['children'] as $day) {
129 129
                         foreach ($day['children'] as $issue) {
130
-                            $title = $issue['label'] ?: $issue['orderlabel'];
130
+                            $title = $issue['label'] ? : $issue['orderlabel'];
131 131
                             if (strtotime($title) !== false) {
132 132
                                 $title = strftime('%x', strtotime($title));
133 133
                             }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 $_day = date('j', $dateTimestamp);
172 172
                 $calendarIssuesByYear[$_year][$_month][$_day][] = $issue;
173 173
             } else {
174
-                $this->logger->warning('Document with UID ' . $issue['uid'] . 'has no valid date of publication');
174
+                $this->logger->warning('Document with UID '.$issue['uid'].'has no valid date of publication');
175 175
             }
176 176
         }
177 177
         // Sort by years.
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
         $this->view->assign('calendarData', $calendarData);
219 219
         $this->view->assign('documentId', $this->document->getUid());
220 220
         $this->view->assign('yearLinkTitle', $yearLinkTitle);
221
-        $this->view->assign('parentDocumentId', $this->document->getPartof() ?: $this->document->getDoc()->tableOfContents[0]['points']);
222
-        $this->view->assign('allYearDocTitle', $this->document->getDoc()->getTitle($this->document->getPartof()) ?: $this->document->getDoc()->tableOfContents[0]['label']);
221
+        $this->view->assign('parentDocumentId', $this->document->getPartof() ? : $this->document->getDoc()->tableOfContents[0]['points']);
222
+        $this->view->assign('allYearDocTitle', $this->document->getDoc()->getTitle($this->document->getPartof()) ? : $this->document->getDoc()->tableOfContents[0]['label']);
223 223
     }
224 224
 
225 225
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
                 if (empty($yearLabel)) {
257 257
                     // if neither order nor orderlabel is set, use the id...
258
-                    $yearLabel = (string)$id;
258
+                    $yearLabel = (string) $id;
259 259
                 }
260 260
 
261 261
                 $years[] = [
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                     if (is_int($key)) {
295 295
                         $yearFilled[] = $yearArray[$key];
296 296
                     } else {
297
-                        $yearFilled[] = ['title' => $min+$i, 'documentId' => ''];
297
+                        $yearFilled[] = ['title' => $min + $i, 'documentId' => ''];
298 298
                     }
299 299
                 }
300 300
                 $yearArray = $yearFilled;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12)
324 324
     {
325 325
         for ($i = $firstMonth; $i <= $lastMonth; $i++) {
326
-            $key = $year . '-' . $i;
326
+            $key = $year.'-'.$i;
327 327
 
328 328
             $calendarData[$key] = [
329 329
                 'DAYMON_NAME' => strftime('%a', strtotime('last Monday')),
@@ -333,16 +333,16 @@  discard block
 block discarded – undo
333 333
                 'DAYFRI_NAME' => strftime('%a', strtotime('last Friday')),
334 334
                 'DAYSAT_NAME' => strftime('%a', strtotime('last Saturday')),
335 335
                 'DAYSUN_NAME' => strftime('%a', strtotime('last Sunday')),
336
-                'MONTHNAME'  => strftime('%B', strtotime($year . '-' . $i . '-1')) . ' ' . $year,
336
+                'MONTHNAME'  => strftime('%B', strtotime($year.'-'.$i.'-1')).' '.$year,
337 337
                 'CALYEAR' => ($i == $firstMonth) ? $year : ''
338 338
             ];
339 339
 
340
-            $firstOfMonth = strtotime($year . '-' . $i . '-1');
340
+            $firstOfMonth = strtotime($year.'-'.$i.'-1');
341 341
             $lastOfMonth = strtotime('last day of', ($firstOfMonth));
342 342
             $firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
343 343
             // There are never more than 6 weeks in a month.
344 344
             for ($j = 0; $j <= 5; $j++) {
345
-                $firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart);
345
+                $firstDayOfWeek = strtotime('+ '.$j.' Week', $firstOfMonthStart);
346 346
 
347 347
                 $calendarData[$key]['week'][$j] = [
348 348
                     'DAYMON' => ['dayValue' => '&nbsp;'],
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                 ];
356 356
                 // Every week has seven days. ;-)
357 357
                 for ($k = 0; $k <= 6; $k++) {
358
-                    $currentDayTime = strtotime('+ ' . $k . ' Day', $firstDayOfWeek);
358
+                    $currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek);
359 359
                     if (
360 360
                         $currentDayTime >= $firstOfMonth
361 361
                         && $currentDayTime <= $lastOfMonth
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                             }
387 387
                             $dayLinkDiv = $dayLinksText;
388 388
                         }
389
-                        switch (strftime('%w', strtotime('+ ' . $k . ' Day', $firstDayOfWeek))) {
389
+                        switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) {
390 390
                             case '0':
391 391
                                 $calendarData[$key]['week'][$j]['DAYSUN']['dayValue'] = strftime('%d', $currentDayTime);
392 392
                                 if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
Please login to merge, or discard this patch.