Passed
Pull Request — master (#123)
by
unknown
11:14
created
Classes/Command/IndexCommand.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
  *
32 32
  * @access public
33 33
  */
34
-class IndexCommand extends BaseCommand
35
-{
34
+class IndexCommand extends BaseCommand {
36 35
 
37 36
     /**
38 37
      * Configure the command by defining the name, options and arguments
Please login to merge, or discard this 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
                 $outputSolrCores = [];
115 115
                 foreach ($allSolrCores as $indexName => $uid) {
116
-                    $outputSolrCores[] = $uid . ' : ' . $indexName;
116
+                    $outputSolrCores[] = $uid.' : '.$indexName;
117 117
                 }
118 118
                 if (empty($outputSolrCores)) {
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", $outputSolrCores) . "\n");
122
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\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
                 return BaseCommand::FAILURE;
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.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             ->setHelp('')
49 49
             ->addOption(
50 50
                 'dry-run',
51
-                null,
51
+                NULL,
52 52
                 InputOption::VALUE_NONE,
53 53
                 'If this option is set, the files will not actually be processed but the location URI is shown.'
54 54
             )
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     protected function execute(InputInterface $input, OutputInterface $output): int
92 92
     {
93
-        $dryRun = $input->getOption('dry-run') != false ? true : false;
93
+        $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE;
94 94
 
95 95
         $io = new SymfonyStyle($input, $output);
96 96
         $io->title($this->getDescription());
@@ -147,31 +147,31 @@  discard block
 block discarded – undo
147 147
                 $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner'));
148 148
             }
149 149
         } else {
150
-            $this->owner = null;
150
+            $this->owner = NULL;
151 151
         }
152 152
 
153
-        $document = null;
154
-        $doc = null;
153
+        $document = NULL;
154
+        $doc = NULL;
155 155
 
156 156
         // Try to find existing document in database
157 157
         if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) {
158 158
 
159 159
             $document = $this->documentRepository->findByUid($input->getOption('doc'));
160 160
 
161
-            if ($document === null) {
161
+            if ($document === NULL) {
162 162
                 $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
163 163
                 return BaseCommand::FAILURE;
164 164
             } else {
165
-                $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
165
+                $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE);
166 166
             }
167 167
 
168 168
         } else if (GeneralUtility::isValidUrl($input->getOption('doc'))) {
169
-            $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true);
169
+            $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE);
170 170
 
171 171
             $document = $this->getDocumentFromUrl($doc, $input->getOption('doc'));
172 172
         }
173 173
 
174
-        if ($doc === null) {
174
+        if ($doc === NULL) {
175 175
             $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.');
176 176
             return BaseCommand::FAILURE;
177 177
         }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     private function getDocumentFromUrl($doc, string $url): Document
225 225
     {
226
-        $document = null;
226
+        $document = NULL;
227 227
 
228 228
         if ($doc->recordId) {
229 229
             $document = $this->documentRepository->findOneByRecordId($doc->recordId);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             $document = $this->documentRepository->findOneByLocation($url);
232 232
         }
233 233
 
234
-        if ($document === null) {
234
+        if ($document === NULL) {
235 235
             // create new Document object
236 236
             $document = GeneralUtility::makeInstance(Document::class);
237 237
         }
Please login to merge, or discard this patch.
Classes/Domain/Repository/StructureRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class StructureRepository extends Repository
26
-{
25
+class StructureRepository extends Repository {
27 26
 
28 27
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/MetadataRepository.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
  *
25 25
  * @access public
26 26
  */
27
-class MetadataRepository extends Repository
28
-{
27
+class MetadataRepository extends Repository {
29 28
     /**
30 29
      * Finds all collection for the given settings
31 30
      *
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
41 41
 
42 42
         $constraints = [];
43 43
 
44
-        if (isset($settings['is_listed']) && $settings['is_listed'] == true) {
44
+        if (isset($settings['is_listed']) && $settings['is_listed'] == TRUE) {
45 45
             $constraints[] = $query->equals('is_listed', 1);
46 46
         }
47 47
 
48
-        if (isset($settings['is_sortable']) && $settings['is_sortable'] == true) {
48
+        if (isset($settings['is_sortable']) && $settings['is_sortable'] == TRUE) {
49 49
             $constraints[] = $query->equals('is_sortable', 1);
50 50
         }
51 51
 
Please login to merge, or discard this patch.
Classes/Domain/Repository/FormatRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class FormatRepository extends Repository
26
-{
25
+class FormatRepository extends Repository {
27 26
 
28 27
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/TokenRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class TokenRepository extends Repository
26
-{
25
+class TokenRepository extends Repository {
27 26
     /**
28 27
      * Delete all expired token
29 28
      *
Please login to merge, or discard this patch.
Classes/Domain/Repository/SolrCoreRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class SolrCoreRepository extends Repository
26
-{
25
+class SolrCoreRepository extends Repository {
27 26
 
28 27
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/LibraryRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class LibraryRepository extends Repository
26
-{
25
+class LibraryRepository extends Repository {
27 26
 
28 27
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/ActionLogRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class ActionLogRepository extends Repository
26
-{
25
+class ActionLogRepository extends Repository {
27 26
 
28 27
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/MailRepository.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @access public
27 27
  */
28
-class MailRepository extends Repository
29
-{
28
+class MailRepository extends Repository {
30 29
 
31 30
     /**
32 31
      * Find all mails by pid.
@@ -37,8 +36,7 @@  discard block
 block discarded – undo
37 36
      * 
38 37
      * @return array|QueryResultInterface
39 38
      */
40
-    public function findAllWithPid(int $pid)
41
-    {
39
+    public function findAllWithPid(int $pid) {
42 40
         /** @var Typo3QuerySettings $querySettings */
43 41
         $querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
44 42
 
Please login to merge, or discard this patch.