Passed
Pull Request — master (#123)
by
unknown
11:56 queued 08:15
created
Classes/Format/Mods.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         if (!empty($name)) {
125 125
             $this->metadata['author'][$i] = [
126 126
                 'name' => $name,
127
-                'url' => 'https://orcid.org/' . $orcidId
127
+                'url' => 'https://orcid.org/'.$orcidId
128 128
             ];
129 129
         } else {
130 130
             //fallback into display form
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         }
182 182
         // Append "valueURI" to name using Unicode unit separator.
183 183
         if (!empty($authors[$i]->getValueURI())) {
184
-            $this->metadata['author'][$i] .= pack('C', 31) . $authors[$i]->getValueURI();
184
+            $this->metadata['author'][$i] .= pack('C', 31).$authors[$i]->getValueURI();
185 185
         }
186 186
     }
187 187
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         if (!empty($name)) {
245 245
             $this->metadata['holder'][$i] = [
246 246
                 'name' => $name,
247
-                'url' => 'http://viaf.org/viaf/' . $viafId
247
+                'url' => 'http://viaf.org/viaf/'.$viafId
248 248
             ];
249 249
         } else {
250 250
             //fallback into display form
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $this->getHolderFromXmlDisplayForm($holders, $i);
268 268
         // Append "valueURI" to name using Unicode unit separator.
269 269
         if (!empty($holders[$i]->getValueURI())) {
270
-            $this->metadata['holder'][$i] .= pack('C', 31) . $holders[$i]->getValueURI();
270
+            $this->metadata['holder'][$i] .= pack('C', 31).$holders[$i]->getValueURI();
271 271
         }
272 272
     }
273 273
 
Please login to merge, or discard this patch.
Classes/Validation/DocumentValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         foreach ($this->requiredMetadataFields as $requiredMetadataField) {
84 84
             if (empty($this->metadata[$requiredMetadataField][0])) {
85
-                $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".');
85
+                $this->logger->error('Missing required metadata field "'.$requiredMetadataField.'".');
86 86
                 return false;
87 87
             }
88 88
         }
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function hasCorrectLogicalStructure(string $type): bool
102 102
     {
103
-        $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]');
103
+        $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="'.$type.'"]');
104 104
         if ($expectedNodes) {
105 105
             return true;
106 106
         }
107 107
 
108 108
         $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
109 109
         if ($existingNodes) {
110
-            $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.');
110
+            $this->logger->error('Document contains logical structure but @TYPE="'.$type.'" is missing.');
111 111
             return false;
112 112
         }
113 113
 
Please login to merge, or discard this patch.
Tests/Unit/Validation/DocumentValidatorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 
106 106
     private function getXml(string $file): SimpleXMLElement
107 107
     {
108
-        $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/MetsDocument/' . $file);
108
+        $xml = simplexml_load_file(__DIR__.'/../../Fixtures/MetsDocument/'.$file);
109 109
         self::assertNotFalse($xml);
110 110
         return $xml;
111 111
     }
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                         $parent->setCurrentDocument($doc);
115 115
                         $success = self::add($parent, $documentRepository);
116 116
                     } else {
117
-                        Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
117
+                        Helper::log('Could not load parent document with UID '.$document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
118 118
                         return false;
119 119
                     }
120 120
                 }
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
             } catch (\Exception $e) {
198 198
                 if (!(Environment::isCli())) {
199 199
                     Helper::addMessage(
200
-                        Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
200
+                        Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()),
201 201
                         Helper::getLanguageService()->getLL('flash.error'),
202 202
                         FlashMessage::ERROR,
203 203
                         true,
204 204
                         'core.template.flashMessages'
205 205
                     );
206 206
                 }
207
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
207
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
208 208
                 return false;
209 209
             }
210 210
         }
211 211
 
212
-        Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core ' . $solrCoreUid, LOG_SEVERITY_ERROR);
212
+        Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core '.$solrCoreUid, LOG_SEVERITY_ERROR);
213 213
         return false;
214 214
     }
215 215
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         // Sanitize input.
231 231
         $pid = max((int) $pid, 0);
232 232
         if (!$pid) {
233
-            Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR);
233
+            Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR);
234 234
             return '';
235 235
         }
236 236
         // Load metadata configuration.
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $suffix = (in_array($indexName, self::$fields['tokenized']) ? 't' : 'u');
240 240
         $suffix .= (in_array($indexName, self::$fields['stored']) ? 's' : 'u');
241 241
         $suffix .= (in_array($indexName, self::$fields['indexed']) ? 'i' : 'u');
242
-        $indexName .= '_' . $suffix;
242
+        $indexName .= '_'.$suffix;
243 243
         return $indexName;
244 244
     }
245 245
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
361 361
                 $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
362 362
                 // verify date formatting
363
-                if(strtotime($metadata['date'][0])) {
363
+                if (strtotime($metadata['date'][0])) {
364 364
                     $solrDoc->setField('date', self::getFormattedDate($metadata['date'][0]));
365 365
                 }
366 366
                 $solrDoc->setField('record_id', $metadata['record_id'][0]);
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
                 $solrDoc->setField(self::getIndexFieldName($indexName, $document->getPid()), $data, self::$fields['fieldboost'][$indexName]);
524 524
                 if (in_array($indexName, self::$fields['sortables'])) {
525 525
                     // Add sortable fields to index.
526
-                    $solrDoc->setField($indexName . '_sorting', $metadata[$indexName . '_sorting'][0]);
526
+                    $solrDoc->setField($indexName.'_sorting', $metadata[$indexName.'_sorting'][0]);
527 527
                 }
528 528
                 if (in_array($indexName, self::$fields['facets'])) {
529 529
                     // Add facets to index.
530
-                    $solrDoc->setField($indexName . '_faceting', $data);
530
+                    $solrDoc->setField($indexName.'_faceting', $data);
531 531
                 }
532 532
                 if (in_array($indexName, self::$fields['autocomplete'])) {
533 533
                     $autocomplete = array_merge($autocomplete, $data);
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                         $data = self::removeAppendsFromAuthor($data);
564 564
                     }
565 565
                     // Add facets to index.
566
-                    $solrDoc->setField($indexName . '_faceting', $data);
566
+                    $solrDoc->setField($indexName.'_faceting', $data);
567 567
                 }
568 568
             }
569 569
             // Add sorting information to physical sub-elements if applicable.
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
         $update = self::$solr->service->createUpdate();
594 594
         $query = "";
595 595
         if ($field == 'uid' || $field == 'partof') {
596
-            $query = $field . ':' . $value;
596
+            $query = $field.':'.$value;
597 597
         } else {
598
-            $query = $field . ':"' . $value . '"';
598
+            $query = $field.':"'.$value.'"';
599 599
         }
600 600
         $update->addDeleteQuery($query);
601 601
         $update->addCommit();
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
     {
621 621
         $solrDoc = $updateQuery->createDocument();
622 622
         // Create unique identifier from document's UID and unit's XML ID.
623
-        $solrDoc->setField('id', $document->getUid() . $unit['id']);
623
+        $solrDoc->setField('id', $document->getUid().$unit['id']);
624 624
         $solrDoc->setField('uid', $document->getUid());
625 625
         $solrDoc->setField('pid', $document->getPid());
626 626
         $solrDoc->setField('partof', $document->getPartof());
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
     private static function handleException(string $errorMessage): void
700 700
     {
701 701
         if (!(Environment::isCli())) {
702
-            self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($errorMessage));
702
+            self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($errorMessage));
703 703
         }
704
-        Helper::log('Apache Solr threw exception: "' . $errorMessage . '"', LOG_SEVERITY_ERROR);
704
+        Helper::log('Apache Solr threw exception: "'.$errorMessage.'"', LOG_SEVERITY_ERROR);
705 705
     }
706 706
 
707 707
     /**
Please login to merge, or discard this patch.
Classes/Command/HarvestCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $this->initializeRepositories((int) $input->getOption('pid'));
112 112
 
113 113
         if ($this->storagePid == 0) {
114
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
114
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
115 115
             return BaseCommand::FAILURE;
116 116
         }
117 117
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
130 130
                 $output_solrCores = [];
131 131
                 foreach ($allSolrCores as $index_name => $uid) {
132
-                    $output_solrCores[] = $uid . ' : ' . $index_name;
132
+                    $output_solrCores[] = $uid.' : '.$index_name;
133 133
                 }
134 134
                 if (empty($output_solrCores)) {
135
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
135
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
136 136
                     return BaseCommand::FAILURE;
137 137
                 } else {
138
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n");
138
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n");
139 139
                     return BaseCommand::FAILURE;
140 140
                 }
141 141
             }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             return BaseCommand::FAILURE;
156 156
         }
157 157
         if (!GeneralUtility::isValidUrl($baseUrl)) {
158
-            $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").');
158
+            $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").');
159 159
             return BaseCommand::FAILURE;
160 160
         } else {
161 161
             try {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 }
198 198
             }
199 199
             if (empty($set)) {
200
-                $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").');
200
+                $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").');
201 201
                 return BaseCommand::FAILURE;
202 202
             }
203 203
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         }
216 216
 
217 217
         // Process all identifiers.
218
-        $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?');
218
+        $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?');
219 219
         foreach ($identifiers as $identifier) {
220 220
             // Build OAI GetRecord URL...
221 221
             $params = [
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
                 'metadataPrefix' => 'mets',
224 224
                 'identifier' => (string) $identifier->identifier
225 225
             ];
226
-            $docLocation = $baseLocation . http_build_query($params);
226
+            $docLocation = $baseLocation.http_build_query($params);
227 227
             // ...index the document...
228 228
             $document = null;
229 229
             $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true);
230 230
 
231 231
             if ($doc === null) {
232
-                $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.');
232
+                $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.');
233 233
                 continue;
234 234
             }
235 235
 
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
             $document->setSolrcore($solrCoreUid);
247 247
 
248 248
             if ($dryRun) {
249
-                $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
249
+                $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
250 250
             } else {
251 251
                 if ($io->isVerbose()) {
252
-                    $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
252
+                    $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
253 253
                 }
254 254
                 $document->setCurrentDocument($doc);
255 255
                 // save to database
@@ -276,6 +276,6 @@  discard block
 block discarded – undo
276 276
      */
277 277
     protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io): void
278 278
     {
279
-        $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n    " . $exception->getMessage());
279
+        $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n    ".$exception->getMessage());
280 280
     }
281 281
 }
Please login to merge, or discard this patch.
Classes/Command/IndexCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->initializeRepositories((int) $input->getOption('pid'));
99 99
 
100 100
         if ($this->storagePid == 0) {
101
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
101
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
102 102
             return BaseCommand::FAILURE;
103 103
         }
104 104
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
114 114
                 $output_solrCores = [];
115 115
                 foreach ($allSolrCores as $index_name => $uid) {
116
-                    $output_solrCores[] = $uid . ' : ' . $index_name;
116
+                    $output_solrCores[] = $uid.' : '.$index_name;
117 117
                 }
118 118
                 if (empty($output_solrCores)) {
119
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
119
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
120 120
                     return BaseCommand::FAILURE;
121 121
                 } else {
122
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n");
122
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n");
123 123
                     return BaseCommand::FAILURE;
124 124
                 }
125 125
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             $document = $this->documentRepository->findByUid($input->getOption('doc'));
160 160
 
161 161
             if ($document === null) {
162
-                $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
162
+                $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .');
163 163
                 exit(1);
164 164
             } else {
165 165
                 $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
@@ -172,31 +172,31 @@  discard block
 block discarded – undo
172 172
         }
173 173
 
174 174
         if ($doc === null) {
175
-            $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.');
175
+            $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.');
176 176
             return BaseCommand::FAILURE;
177 177
         }
178 178
 
179 179
         $document->setSolrcore($solrCoreUid);
180 180
 
181 181
         if ($dryRun) {
182
-            $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
182
+            $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
183 183
             $io->success('All done!');
184 184
             return BaseCommand::SUCCESS;
185 185
         } else {
186 186
             $document->setCurrentDocument($doc);
187 187
 
188 188
             if ($io->isVerbose()) {
189
-                $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.');
189
+                $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.');
190 190
             }
191 191
             $isSaved = $this->saveToDatabase($document);
192 192
 
193 193
             if ($isSaved) {
194 194
                 if ($io->isVerbose()) {
195
-                    $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on Solr core ' . $solrCoreUid . '.');
195
+                    $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on Solr core '.$solrCoreUid.'.');
196 196
                 }
197 197
                 $isSaved = Indexer::add($document, $this->documentRepository);
198 198
             } else {
199
-                $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on PID ' . $this->storagePid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.');
199
+                $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on PID '.$this->storagePid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.');
200 200
                 return BaseCommand::FAILURE;
201 201
             }
202 202
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                 return BaseCommand::SUCCESS;
206 206
             }
207 207
 
208
-            $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on Solr core ' . $solrCoreUid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.');
209
-            $io->info('INFO: Document with UID "' . $document->getUid() . '" is already in database. If you want to keep the database and index consistent you need to remove it.');
208
+            $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on Solr core '.$solrCoreUid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.');
209
+            $io->info('INFO: Document with UID "'.$document->getUid().'" is already in database. If you want to keep the database and index consistent you need to remove it.');
210 210
             return BaseCommand::FAILURE;
211 211
         }
212 212
     }
Please login to merge, or discard this patch.
Classes/Command/DeleteCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $this->initializeRepositories((int) $input->getOption('pid'));
85 85
 
86 86
         if ($this->storagePid == 0) {
87
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
87
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
88 88
             return BaseCommand::FAILURE;
89 89
         }
90 90
 
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
100 100
                 $outputSolrCores = [];
101 101
                 foreach ($allSolrCores as $indexName => $uid) {
102
-                    $outputSolrCores[] = $uid . ' : ' . $indexName;
102
+                    $outputSolrCores[] = $uid.' : '.$indexName;
103 103
                 }
104 104
                 if (empty($outputSolrCores)) {
105
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
105
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
106 106
                     return BaseCommand::FAILURE;
107 107
                 } else {
108
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n");
108
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n");
109 109
                     return BaseCommand::FAILURE;
110 110
                 }
111 111
             }
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
         $document = $this->getDocument($input);
148 148
 
149 149
         if ($document === null) {
150
-            $io->info('INFO: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . '. It is probably already deleted from DB.');
150
+            $io->info('INFO: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.'. It is probably already deleted from DB.');
151 151
         } else {
152 152
             if ($io->isVerbose()) {
153
-                $io->section('Deleting ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.');
153
+                $io->section('Deleting '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.');
154 154
             }
155 155
             $this->documentRepository->remove($document);
156 156
             $this->persistenceManager->persistAll();
157 157
             if ($io->isVerbose()) {
158
-                $io->success('Deleted ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.');
158
+                $io->success('Deleted '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.');
159 159
             }
160 160
         }
161 161
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     private function deleteFromSolr($input, $io, $solrCoreUid): void
175 175
     {
176 176
         if ($io->isVerbose()) {
177
-            $io->section('Deleting ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.');
177
+            $io->section('Deleting '.$input->getOption('doc').' on Solr core '.$solrCoreUid.'.');
178 178
         }
179 179
 
180 180
         $isDeleted = false;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         if ($isDeleted) {
189 189
             if ($io->isVerbose()) {
190
-                $io->success('Deleted ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.');
190
+                $io->success('Deleted '.$input->getOption('doc').' on Solr core '.$solrCoreUid.'.');
191 191
             }
192 192
             $io->success('All done!');
193 193
         } else {
Please login to merge, or discard this patch.
Classes/Controller/SearchController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         }
123 123
 
124 124
         if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) {
125
-            $this->searchParams = array_merge($this->searchParams ?: [], $listRequestData['searchParameter']);
125
+            $this->searchParams = array_merge($this->searchParams ? : [], $listRequestData['searchParameter']);
126 126
             $listViewSearch = true;
127 127
             $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams);
128 128
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                 $simplePagination = new SimplePagination($solrPaginator);
184 184
 
185 185
                 $pagination = $this->buildSimplePagination($simplePagination, $solrPaginator);
186
-                $this->view->assignMultiple([ 'pagination' => $pagination, 'paginator' => $solrPaginator ]);
186
+                $this->view->assignMultiple(['pagination' => $pagination, 'paginator' => $solrPaginator]);
187 187
             }
188 188
 
189 189
             $this->view->assign('documents', !empty($solrResults) ? $solrResults : []);
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         // Add uHash parameter to suggest parameter to make a basic protection of this form.
210 210
         if ($this->settings['suggest']) {
211
-            $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest'));
211
+            $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest'));
212 212
         }
213 213
 
214 214
         $this->view->assign('viewData', $this->viewData);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         // Get facets from plugin configuration.
230 230
         $facets = [];
231 231
         foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) {
232
-            $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']);
232
+            $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']);
233 233
         }
234 234
 
235 235
         $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets));
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         $searchParams = $this->searchParams;
266 266
         if (
267 267
             (!empty($searchParams['fulltext']))
268
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches)
268
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches)
269 269
         ) {
270 270
             // If the query already is a fulltext query e.g using the facets
271 271
             $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1];
272 272
             // Search in fulltext field if applicable. Query must not be empty!
273 273
             if (!empty($searchParams['query'])) {
274
-                $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')';
274
+                $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')';
275 275
             }
276 276
         } else {
277 277
             // Retain given search field if valid.
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         // add filter query for date search
289 289
         if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
290 290
             // combine dateFrom and dateTo into filterquery as range search
291
-            $search['params']['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}' . $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']';
291
+            $search['params']['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']';
292 292
         }
293 293
 
294 294
         // Add extended search query.
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
                         in_array($searchParams['extOperator'][$i], $allowedOperators)
307 307
                     ) {
308 308
                         if (!empty($search['query'])) {
309
-                            $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' ';
309
+                            $search['query'] .= ' '.$searchParams['extOperator'][$i].' ';
310 310
                         }
311
-                        $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')';
311
+                        $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')';
312 312
                     }
313 313
                 }
314 314
             }
@@ -397,24 +397,24 @@  discard block
 block discarded – undo
397 397
             foreach ($collections as $collectionEntry) {
398 398
                 // check for virtual collections query string
399 399
                 if ($collectionEntry->getIndexSearch()) {
400
-                    $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')';
400
+                    $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collectionEntry->getIndexSearch().')' : ' OR ('.$collectionEntry->getIndexSearch().')';
401 401
                 } else {
402
-                    $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"';
402
+                    $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collectionEntry->getIndexName().'"' : ' OR "'.$collectionEntry->getIndexName().'"';
403 403
                 }
404 404
             }
405 405
 
406 406
             // distinguish between simple collection browsing and actual searching within the collection(s)
407 407
             if (!empty($collectionsQueryString)) {
408 408
                 if (empty($query)) {
409
-                    $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)';
409
+                    $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)';
410 410
                 } else {
411
-                    $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))';
411
+                    $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))';
412 412
                 }
413 413
             }
414 414
 
415 415
             // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately
416 416
             if (!empty($virtualCollectionsQueryString)) {
417
-                $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')';
417
+                $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')';
418 418
             }
419 419
 
420 420
             // combine both querystrings into a single filterquery via OR if both are given, otherwise pass either of those
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
         $entryArray['doNotLinkIt'] = 0;
445 445
         // Check if facet is already selected.
446 446
         $queryColumn = array_column($search['params']['filterquery'], 'query');
447
-        $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn);
447
+        $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn);
448 448
         if ($index !== false) {
449 449
             // Facet is selected, thus remove it from filter.
450 450
             unset($queryColumn[$index]);
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
             }
459 459
         } else {
460 460
             // Facet is not selected, thus add it to filter.
461
-            $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")';
461
+            $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")';
462 462
             $entryArray['ITEM_STATE'] = 'NO';
463 463
         }
464 464
         $entryArray['queryColumn'] = $queryColumn;
Please login to merge, or discard this patch.
Classes/Command/ReindexCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $this->initializeRepositories((int) $input->getOption('pid'));
115 115
 
116 116
         if ($this->storagePid == 0) {
117
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
117
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
118 118
             return BaseCommand::FAILURE;
119 119
         }
120 120
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
130 130
                 $output_solrCores = [];
131 131
                 foreach ($allSolrCores as $index_name => $uid) {
132
-                    $output_solrCores[] = $uid . ' : ' . $index_name;
132
+                    $output_solrCores[] = $uid.' : '.$index_name;
133 133
                 }
134 134
                 if (empty($output_solrCores)) {
135
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
135
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
136 136
                     return BaseCommand::FAILURE;
137 137
                 } else {
138
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n");
138
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n");
139 139
                     return BaseCommand::FAILURE;
140 140
                 }
141 141
             }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                     ->setLimit((int) $input->getOption('index-limit'))
166 166
                     ->setOffset((int) $input->getOption('index-begin'))
167 167
                     ->execute();
168
-                $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.');
168
+                $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.');
169 169
             } else {
170 170
                 // Get all documents.
171 171
                 $documents = $this->documentRepository->findAll();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             ) {
188 188
                 $documents = $this->documentRepository->findAllByCollectionsLimited($collections, (int) $input->getOption('index-limit'), (int) $input->getOption('index-begin'));
189 189
 
190
-                $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.');
190
+                $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.');
191 191
             } else {
192 192
                 // Get all documents of given collections.
193 193
                 $documents = $this->documentRepository->findAllByCollectionsLimited($collections, 0);
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
             $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
202 202
 
203 203
             if ($doc === null) {
204
-                $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.');
204
+                $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.');
205 205
                 continue;
206 206
             }
207 207
 
208 208
             if ($dryRun) {
209
-                $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . '  with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
209
+                $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).'  with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
210 210
             } else {
211 211
                 if ($io->isVerbose()) {
212
-                    $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
212
+                    $io->writeln(date('Y-m-d H:i:s').' Indexing '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
213 213
                 }
214 214
                 $document->setCurrentDocument($doc);
215 215
                 // save to database
Please login to merge, or discard this patch.