@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->initializeRepositories($input->getOption('pid')); |
97 | 97 | |
98 | 98 | if ($this->storagePid == 0) { |
99 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
99 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
100 | 100 | exit(1); |
101 | 101 | } |
102 | 102 | |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
112 | 112 | $output_solrCores = []; |
113 | 113 | foreach ($allSolrCores as $index_name => $uid) { |
114 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
114 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
115 | 115 | } |
116 | 116 | if (empty($output_solrCores)) { |
117 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
117 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
118 | 118 | exit(1); |
119 | 119 | } else { |
120 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
120 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
121 | 121 | exit(1); |
122 | 122 | } |
123 | 123 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
158 | 158 | |
159 | 159 | if ($document === null) { |
160 | - $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .'); |
|
160 | + $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .'); |
|
161 | 161 | exit(1); |
162 | 162 | } else { |
163 | 163 | $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
@@ -182,17 +182,17 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | if ($doc === null) { |
185 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
185 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
186 | 186 | exit(1); |
187 | 187 | } |
188 | 188 | |
189 | 189 | $document->setSolrcore($solrCoreUid); |
190 | 190 | |
191 | 191 | if ($dryRun) { |
192 | - $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
192 | + $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
193 | 193 | } else { |
194 | 194 | if ($io->isVerbose()) { |
195 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
195 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
196 | 196 | } |
197 | 197 | $document->setDoc($doc); |
198 | 198 | // save to database |
@@ -33,16 +33,14 @@ discard block |
||
33 | 33 | * @subpackage dlf |
34 | 34 | * @access public |
35 | 35 | */ |
36 | -class IndexCommand extends BaseCommand |
|
37 | -{ |
|
36 | +class IndexCommand extends BaseCommand { |
|
38 | 37 | |
39 | 38 | /** |
40 | 39 | * Configure the command by defining the name, options and arguments |
41 | 40 | * |
42 | 41 | * @return void |
43 | 42 | */ |
44 | - public function configure() |
|
45 | - { |
|
43 | + public function configure() { |
|
46 | 44 | $this |
47 | 45 | ->setDescription('Index single document into database and Solr.') |
48 | 46 | ->setHelp('') |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | * |
87 | 85 | * @return int |
88 | 86 | */ |
89 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
90 | - { |
|
87 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
91 | 88 | $dryRun = $input->getOption('dry-run') != false ? true : false; |
92 | 89 | |
93 | 90 | $io = new SymfonyStyle($input, $output); |
@@ -48,7 +48,7 @@ discard block |
||
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 | ) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function execute(InputInterface $input, OutputInterface $output) |
90 | 90 | { |
91 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
91 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
92 | 92 | |
93 | 93 | $io = new SymfonyStyle($input, $output); |
94 | 94 | $io->title($this->getDescription()); |
@@ -145,32 +145,32 @@ discard block |
||
145 | 145 | $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); |
146 | 146 | } |
147 | 147 | } else { |
148 | - $this->owner = null; |
|
148 | + $this->owner = NULL; |
|
149 | 149 | } |
150 | 150 | |
151 | - $document = null; |
|
152 | - $doc = null; |
|
151 | + $document = NULL; |
|
152 | + $doc = NULL; |
|
153 | 153 | |
154 | 154 | // Try to find existing document in database |
155 | 155 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
156 | 156 | |
157 | 157 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
158 | 158 | |
159 | - if ($document === null) { |
|
159 | + if ($document === NULL) { |
|
160 | 160 | $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .'); |
161 | 161 | exit(1); |
162 | 162 | } else { |
163 | - $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
|
163 | + $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | } else if (GeneralUtility::isValidUrl($input->getOption('doc'))) { |
167 | - $doc = Doc::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true); |
|
167 | + $doc = Doc::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE); |
|
168 | 168 | |
169 | 169 | if ($doc->recordId) { |
170 | 170 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
171 | 171 | } |
172 | 172 | |
173 | - if ($document === null) { |
|
173 | + if ($document === NULL) { |
|
174 | 174 | // create new Document object |
175 | 175 | $document = GeneralUtility::makeInstance(Document::class); |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if ($doc === null) { |
|
184 | + if ($doc === NULL) { |
|
185 | 185 | $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
186 | 186 | exit(1); |
187 | 187 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $this->initializeRepositories($input->getOption('pid')); |
101 | 101 | |
102 | 102 | if ($this->storagePid == 0) { |
103 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
103 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
104 | 104 | exit(1); |
105 | 105 | } |
106 | 106 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
116 | 116 | $output_solrCores = []; |
117 | 117 | foreach ($allSolrCores as $index_name => $uid) { |
118 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
118 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
119 | 119 | } |
120 | 120 | if (empty($output_solrCores)) { |
121 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
121 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
122 | 122 | exit(1); |
123 | 123 | } else { |
124 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
124 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
125 | 125 | exit(1); |
126 | 126 | } |
127 | 127 | } |
@@ -163,15 +163,15 @@ discard block |
||
163 | 163 | $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
164 | 164 | |
165 | 165 | if ($doc === null) { |
166 | - $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
|
166 | + $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.'); |
|
167 | 167 | continue; |
168 | 168 | } |
169 | 169 | |
170 | 170 | if ($dryRun) { |
171 | - $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
171 | + $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
172 | 172 | } else { |
173 | 173 | if ($io->isVerbose()) { |
174 | - $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 . '.'); |
|
174 | + $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.'.'); |
|
175 | 175 | } |
176 | 176 | $document->setDoc($doc); |
177 | 177 | // save to database |
@@ -32,15 +32,13 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class ReindexCommand extends BaseCommand |
|
36 | -{ |
|
35 | +class ReindexCommand extends BaseCommand { |
|
37 | 36 | /** |
38 | 37 | * Configure the command by defining the name, options and arguments |
39 | 38 | * |
40 | 39 | * @return void |
41 | 40 | */ |
42 | - public function configure() |
|
43 | - { |
|
41 | + public function configure() { |
|
44 | 42 | $this |
45 | 43 | ->setDescription('Reindex a collection into database and Solr.') |
46 | 44 | ->setHelp('') |
@@ -90,8 +88,7 @@ discard block |
||
90 | 88 | * |
91 | 89 | * @return int |
92 | 90 | */ |
93 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
94 | - { |
|
91 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
95 | 92 | $dryRun = $input->getOption('dry-run') != false ? true : false; |
96 | 93 | |
97 | 94 | $io = new SymfonyStyle($input, $output); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ->setHelp('') |
47 | 47 | ->addOption( |
48 | 48 | 'dry-run', |
49 | - null, |
|
49 | + NULL, |
|
50 | 50 | InputOption::VALUE_NONE, |
51 | 51 | 'If this option is set, the files will not actually be processed but the location URI is shown.' |
52 | 52 | ) |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function execute(InputInterface $input, OutputInterface $output) |
94 | 94 | { |
95 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
95 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
96 | 96 | |
97 | 97 | $io = new SymfonyStyle($input, $output); |
98 | 98 | $io->title($this->getDescription()); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); |
138 | 138 | } |
139 | 139 | } else { |
140 | - $this->owner = null; |
|
140 | + $this->owner = NULL; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (!empty($input->getOption('all'))) { |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | && !is_array($input->getOption('coll')) |
149 | 149 | ) { |
150 | 150 | // "coll" may be a single integer or a comma-separated list of integers. |
151 | - if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), true)))) { |
|
151 | + if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE)))) { |
|
152 | 152 | $io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.'); |
153 | 153 | exit(1); |
154 | 154 | } |
155 | 155 | // Get all documents of given collections. |
156 | - $documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), true), 0); |
|
156 | + $documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE), 0); |
|
157 | 157 | } else { |
158 | 158 | $io->error('ERROR: One of parameters --all|-a or --coll|-c must be given.'); |
159 | 159 | exit(1); |
160 | 160 | } |
161 | 161 | |
162 | 162 | foreach ($documents as $id => $document) { |
163 | - $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
|
163 | + $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE); |
|
164 | 164 | |
165 | - if ($doc === null) { |
|
165 | + if ($doc === NULL) { |
|
166 | 166 | $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
167 | 167 | continue; |
168 | 168 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $this->initializeRepositories($input->getOption('pid')); |
111 | 111 | |
112 | 112 | if ($this->storagePid == 0) { |
113 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
113 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
114 | 114 | exit(1); |
115 | 115 | } |
116 | 116 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
129 | 129 | $output_solrCores = []; |
130 | 130 | foreach ($allSolrCores as $index_name => $uid) { |
131 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
131 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
132 | 132 | } |
133 | 133 | if (empty($output_solrCores)) { |
134 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
134 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
135 | 135 | exit(1); |
136 | 136 | } else { |
137 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
137 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
138 | 138 | exit(1); |
139 | 139 | } |
140 | 140 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | exit(1); |
155 | 155 | } |
156 | 156 | if (!GeneralUtility::isValidUrl($baseUrl)) { |
157 | - $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").'); |
|
157 | + $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").'); |
|
158 | 158 | exit(1); |
159 | 159 | } else { |
160 | 160 | try { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | } |
197 | 197 | if (empty($set)) { |
198 | - $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").'); |
|
198 | + $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").'); |
|
199 | 199 | exit(1); |
200 | 200 | } |
201 | 201 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Process all identifiers. |
211 | - $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
211 | + $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
212 | 212 | foreach ($identifiers as $identifier) { |
213 | 213 | // Build OAI GetRecord URL... |
214 | 214 | $params = [ |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | 'metadataPrefix' => 'mets', |
217 | 217 | 'identifier' => (string) $identifier->identifier |
218 | 218 | ]; |
219 | - $docLocation = $baseLocation . http_build_query($params); |
|
219 | + $docLocation = $baseLocation.http_build_query($params); |
|
220 | 220 | // ...index the document... |
221 | 221 | $document = null; |
222 | 222 | $doc = Doc::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
223 | 223 | |
224 | 224 | if ($doc === null) { |
225 | - $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
|
225 | + $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.'); |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | $document->setSolrcore($solrCoreUid); |
240 | 240 | |
241 | 241 | if ($dryRun) { |
242 | - $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
242 | + $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
243 | 243 | } else { |
244 | 244 | if ($io->isVerbose()) { |
245 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
245 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
246 | 246 | } |
247 | 247 | $document->setDoc($doc); |
248 | 248 | // save to database |
@@ -267,6 +267,6 @@ discard block |
||
267 | 267 | */ |
268 | 268 | protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) |
269 | 269 | { |
270 | - $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
|
270 | + $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n ".$exception->getMessage()); |
|
271 | 271 | } |
272 | 272 | } |
@@ -36,15 +36,13 @@ discard block |
||
36 | 36 | * @subpackage dlf |
37 | 37 | * @access public |
38 | 38 | */ |
39 | -class HarvestCommand extends BaseCommand |
|
40 | -{ |
|
39 | +class HarvestCommand extends BaseCommand { |
|
41 | 40 | /** |
42 | 41 | * Configure the command by defining the name, options and arguments |
43 | 42 | * |
44 | 43 | * @return void |
45 | 44 | */ |
46 | - public function configure() |
|
47 | - { |
|
45 | + public function configure() { |
|
48 | 46 | $this |
49 | 47 | ->setDescription('Harvest OAI-PMH contents into database and Solr.') |
50 | 48 | ->setHelp('') |
@@ -100,8 +98,7 @@ discard block |
||
100 | 98 | * |
101 | 99 | * @return int |
102 | 100 | */ |
103 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
104 | - { |
|
101 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
105 | 102 | $dryRun = $input->getOption('dry-run') != false ? true : false; |
106 | 103 | |
107 | 104 | $io = new SymfonyStyle($input, $output); |
@@ -265,8 +262,7 @@ discard block |
||
265 | 262 | * |
266 | 263 | * @return void |
267 | 264 | */ |
268 | - protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) |
|
269 | - { |
|
265 | + protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) { |
|
270 | 266 | $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
271 | 267 | } |
272 | 268 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ->setHelp('') |
51 | 51 | ->addOption( |
52 | 52 | 'dry-run', |
53 | - null, |
|
53 | + NULL, |
|
54 | 54 | InputOption::VALUE_NONE, |
55 | 55 | 'If this option is set, the files will not actually be processed but the location URIs are shown.' |
56 | 56 | ) |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | ) |
75 | 75 | ->addOption( |
76 | 76 | 'from', |
77 | - null, |
|
77 | + NULL, |
|
78 | 78 | InputOption::VALUE_OPTIONAL, |
79 | 79 | 'Datestamp (YYYY-MM-DD) to begin harvesting from.' |
80 | 80 | ) |
81 | 81 | ->addOption( |
82 | 82 | 'until', |
83 | - null, |
|
83 | + NULL, |
|
84 | 84 | InputOption::VALUE_OPTIONAL, |
85 | 85 | 'Datestamp (YYYY-MM-DD) to end harvesting on.' |
86 | 86 | ) |
87 | 87 | ->addOption( |
88 | 88 | 'set', |
89 | - null, |
|
89 | + NULL, |
|
90 | 90 | InputOption::VALUE_OPTIONAL, |
91 | 91 | 'Name of the set to limit harvesting to.' |
92 | 92 | ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function execute(InputInterface $input, OutputInterface $output) |
104 | 104 | { |
105 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
105 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
106 | 106 | |
107 | 107 | $io = new SymfonyStyle($input, $output); |
108 | 108 | $io->title($this->getDescription()); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | $from = new \DateTime($input->getOption('from')); |
172 | 172 | } else { |
173 | - $from = null; |
|
173 | + $from = NULL; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | if ( |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | ) { |
180 | 180 | $until = new \DateTime($input->getOption('until')); |
181 | 181 | } else { |
182 | - $until = null; |
|
182 | + $until = NULL; |
|
183 | 183 | } |
184 | 184 | |
185 | - $set = null; |
|
185 | + $set = NULL; |
|
186 | 186 | if ( |
187 | 187 | !is_array($input->getOption('set')) |
188 | 188 | && !empty($input->getOption('set')) |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | ]; |
219 | 219 | $docLocation = $baseLocation . http_build_query($params); |
220 | 220 | // ...index the document... |
221 | - $document = null; |
|
222 | - $doc = Doc::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
|
221 | + $document = NULL; |
|
222 | + $doc = Doc::getInstance($docLocation, ['storagePid' => $this->storagePid], TRUE); |
|
223 | 223 | |
224 | - if ($doc === null) { |
|
224 | + if ($doc === NULL) { |
|
225 | 225 | $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
226 | 226 | continue; |
227 | 227 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
231 | 231 | } |
232 | 232 | |
233 | - if ($document === null) { |
|
233 | + if ($document === NULL) { |
|
234 | 234 | // create new Document object |
235 | 235 | $document = GeneralUtility::makeInstance(Document::class); |
236 | 236 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getDescription(): string |
56 | 56 | { |
57 | - return 'This wizard migrates existing front end plugins of the extension Kitodo.Presentation (dlf) to' . |
|
58 | - ' make use of the Extbase naming scheme. Therefore it updates the field values' . |
|
57 | + return 'This wizard migrates existing front end plugins of the extension Kitodo.Presentation (dlf) to'. |
|
58 | + ' make use of the Extbase naming scheme. Therefore it updates the field values'. |
|
59 | 59 | ' "pi_flexform" within the tt_content table'; |
60 | 60 | } |
61 | 61 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | foreach ($fields as $field) { |
171 | 171 | // change the index attribute if it doesn't start with 'settings.' yet |
172 | 172 | if (strpos($field['index'], 'settings.') === false) { |
173 | - $field['index'] = 'settings.' . $field['index']; |
|
173 | + $field['index'] = 'settings.'.$field['index']; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 |
@@ -23,8 +23,7 @@ |
||
23 | 23 | * Class MigrateSettings |
24 | 24 | * @internal |
25 | 25 | */ |
26 | -class MigrateSettings implements UpgradeWizardInterface |
|
27 | -{ |
|
26 | +class MigrateSettings implements UpgradeWizardInterface { |
|
28 | 27 | |
29 | 28 | /** |
30 | 29 | * Return the identifier for this wizard |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | |
98 | 98 | // exit if at least one update statement is not successful |
99 | 99 | if (!((bool) $updateResult)) { |
100 | - return false; |
|
100 | + return FALSE; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - return true; |
|
104 | + return TRUE; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function updateNecessary(): bool |
115 | 115 | { |
116 | - $oldSettingsFound = false; |
|
116 | + $oldSettingsFound = FALSE; |
|
117 | 117 | |
118 | 118 | $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_content'); |
119 | 119 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // Update the found record sets |
132 | 132 | while ($record = $statement->fetch()) { |
133 | 133 | $oldSettingsFound = $this->checkForOldSettings($record['pi_flexform']); |
134 | - if ($oldSettingsFound === true) { |
|
134 | + if ($oldSettingsFound === TRUE) { |
|
135 | 135 | // We found at least one field to be updated --> break here |
136 | 136 | break; |
137 | 137 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | foreach ($fields as $field) { |
171 | 171 | // change the index attribute if it doesn't start with 'settings.' yet |
172 | - if (strpos($field['index'], 'settings.') === false) { |
|
172 | + if (strpos($field['index'], 'settings.') === FALSE) { |
|
173 | 173 | $field['index'] = 'settings.' . $field['index']; |
174 | 174 | } |
175 | 175 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | $queryBuilder->createNamedParameter('', \PDO::PARAM_STR) |
173 | 173 | ), |
174 | 174 | $queryBuilder->expr()->comparison( |
175 | - 'CAST(CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS DECIMAL) AS CHAR)', |
|
175 | + 'CAST(CAST('.$queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]).' AS DECIMAL) AS CHAR)', |
|
176 | 176 | ExpressionBuilder::NEQ, |
177 | - 'CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS CHAR)' |
|
177 | + 'CAST('.$queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]).' AS CHAR)' |
|
178 | 178 | ) |
179 | 179 | ) |
180 | 180 | ->orderBy('uid') |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } catch (DBALException $e) { |
189 | 189 | throw new \RuntimeException( |
190 | - 'Database query failed. Error was: ' . $e->getPrevious()->getMessage(), |
|
190 | + 'Database query failed. Error was: '.$e->getPrevious()->getMessage(), |
|
191 | 191 | 1511950673 |
192 | 192 | ); |
193 | 193 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
247 | 247 | |
248 | 248 | $fileUid = null; |
249 | - $sourcePath = Environment::getPublicPath() . '/' . $fieldItem; |
|
249 | + $sourcePath = Environment::getPublicPath().'/'.$fieldItem; |
|
250 | 250 | |
251 | 251 | // maybe the file was already moved, so check if the original file still exists |
252 | 252 | if (file_exists($sourcePath)) { |
@@ -153,8 +153,7 @@ discard block |
||
153 | 153 | * @return array|int |
154 | 154 | * @throws \RuntimeException |
155 | 155 | */ |
156 | - protected function getRecordsFromTable($countOnly = false) |
|
157 | - { |
|
156 | + protected function getRecordsFromTable($countOnly = false) { |
|
158 | 157 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
159 | 158 | $allResults = []; |
160 | 159 | $numResults = 0; |
@@ -234,8 +233,7 @@ discard block |
||
234 | 233 | * @param array $row |
235 | 234 | * @throws \Exception |
236 | 235 | */ |
237 | - protected function migrateField($table, $row) |
|
238 | - { |
|
236 | + protected function migrateField($table, $row) { |
|
239 | 237 | $fieldItem = trim($row[$this->fieldsToMigrate[$table]]); |
240 | 238 | |
241 | 239 | if (empty($fieldItem) || is_numeric($fieldItem)) { |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function updateNecessary(): bool |
99 | 99 | { |
100 | - $numRecords = $this->getRecordsFromTable(true); |
|
100 | + $numRecords = $this->getRecordsFromTable(TRUE); |
|
101 | 101 | if ($numRecords > 0) { |
102 | - return true; |
|
102 | + return TRUE; |
|
103 | 103 | } |
104 | - return false; |
|
104 | + return FALSE; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function executeUpdate(): bool |
133 | 133 | { |
134 | - $result = true; |
|
134 | + $result = TRUE; |
|
135 | 135 | try { |
136 | - $numRecords = $this->getRecordsFromTable(true); |
|
136 | + $numRecords = $this->getRecordsFromTable(TRUE); |
|
137 | 137 | if ($numRecords > 0) { |
138 | 138 | $this->performUpdate(); |
139 | 139 | } |
140 | 140 | } catch (\Exception $e) { |
141 | 141 | // If something goes wrong, migrateField() logs an error |
142 | - $result = false; |
|
142 | + $result = FALSE; |
|
143 | 143 | } |
144 | 144 | return $result; |
145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return array|int |
154 | 154 | * @throws \RuntimeException |
155 | 155 | */ |
156 | - protected function getRecordsFromTable($countOnly = false) |
|
156 | + protected function getRecordsFromTable($countOnly = FALSE) |
|
157 | 157 | { |
158 | 158 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
159 | 159 | $allResults = []; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | ->orderBy('uid') |
181 | 181 | ->execute() |
182 | 182 | ->fetchAll(); |
183 | - if ($countOnly === true) { |
|
183 | + if ($countOnly === TRUE) { |
|
184 | 184 | $numResults += count($result); |
185 | 185 | } else { |
186 | 186 | $allResults[$table] = $result; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | - if ($countOnly === true) { |
|
196 | + if ($countOnly === TRUE) { |
|
197 | 197 | return $numResults; |
198 | 198 | } else { |
199 | 199 | return $allResults; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | protected function performUpdate(): bool |
210 | 210 | { |
211 | - $result = true; |
|
211 | + $result = TRUE; |
|
212 | 212 | |
213 | 213 | try { |
214 | 214 | $storages = GeneralUtility::makeInstance(StorageRepository::class)->findAll(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | } catch (\Exception $e) { |
224 | - $result = false; |
|
224 | + $result = FALSE; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $result; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $storageUid = (int) $this->storage->getUid(); |
246 | 246 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
247 | 247 | |
248 | - $fileUid = null; |
|
248 | + $fileUid = NULL; |
|
249 | 249 | $sourcePath = Environment::getPublicPath() . '/' . $fieldItem; |
250 | 250 | |
251 | 251 | // maybe the file was already moved, so check if the original file still exists |
@@ -19,13 +19,11 @@ |
||
19 | 19 | /** |
20 | 20 | * Add inline JavaScript code to footer * |
21 | 21 | */ |
22 | -class JsFooterViewHelper extends AbstractViewHelper |
|
23 | -{ |
|
22 | +class JsFooterViewHelper extends AbstractViewHelper { |
|
24 | 23 | /** |
25 | 24 | * Initialize arguments. |
26 | 25 | */ |
27 | - public function initializeArguments() |
|
28 | - { |
|
26 | + public function initializeArguments() { |
|
29 | 27 | parent::initializeArguments(); |
30 | 28 | $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
31 | 29 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function initializeArguments() |
28 | 28 | { |
29 | 29 | parent::initializeArguments(); |
30 | - $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
|
30 | + $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', TRUE); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @subpackage dlf |
27 | 27 | * @access public |
28 | 28 | */ |
29 | -class PageViewController extends AbstractController |
|
30 | -{ |
|
29 | +class PageViewController extends AbstractController { |
|
31 | 30 | /** |
32 | 31 | * Holds the controls to add to the map |
33 | 32 | * |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * |
66 | 65 | * @return void |
67 | 66 | */ |
68 | - public function mainAction() |
|
69 | - { |
|
67 | + public function mainAction() { |
|
70 | 68 | // Load current document. |
71 | 69 | $this->loadDocument($this->requestData); |
72 | 70 | if ( |
@@ -121,8 +119,7 @@ discard block |
||
121 | 119 | * |
122 | 120 | * @return array URL and MIME type of fulltext file |
123 | 121 | */ |
124 | - protected function getFulltext($page) |
|
125 | - { |
|
122 | + protected function getFulltext($page) { |
|
126 | 123 | $fulltext = []; |
127 | 124 | // Get fulltext link. |
128 | 125 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->extConf['fileGrpFulltext']); |
@@ -162,8 +159,7 @@ discard block |
||
162 | 159 | * |
163 | 160 | * @return void |
164 | 161 | */ |
165 | - protected function addViewerJS() |
|
166 | - { |
|
162 | + protected function addViewerJS() { |
|
167 | 163 | // Viewer configuration. |
168 | 164 | $viewerConfiguration = '$(document).ready(function() { |
169 | 165 | if (dlfUtils.exists(dlfViewer)) { |
@@ -189,8 +185,7 @@ discard block |
||
189 | 185 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
190 | 186 | * some information about the canvas. |
191 | 187 | */ |
192 | - protected function getAnnotationContainers($page) |
|
193 | - { |
|
188 | + protected function getAnnotationContainers($page) { |
|
194 | 189 | if ($this->document->getDoc() instanceof IiifManifest) { |
195 | 190 | $canvasId = $this->document->getDoc()->physicalStructure[$page]; |
196 | 191 | $iiif = $this->document->getDoc()->getIiif(); |
@@ -246,8 +241,7 @@ discard block |
||
246 | 241 | * |
247 | 242 | * @return array URL and MIME type of image file |
248 | 243 | */ |
249 | - protected function getImage($page) |
|
250 | - { |
|
244 | + protected function getImage($page) { |
|
251 | 245 | $image = []; |
252 | 246 | // Get @USE value of METS fileGrp. |
253 | 247 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->extConf['fileGrpImages']); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // Load current document. |
71 | 71 | $this->loadDocument($this->requestData); |
72 | 72 | if ( |
73 | - $this->document === null |
|
73 | + $this->document === NULL |
|
74 | 74 | || $this->document->getDoc()->numPages < 1 |
75 | 75 | ) { |
76 | 76 | // Quit without doing anything if required variables are not set. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // Configure @action URL for form. |
134 | 134 | $uri = $this->uriBuilder->reset() |
135 | 135 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
136 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
136 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
137 | 137 | ->setArguments([ |
138 | 138 | 'eID' => 'tx_dlf_pageview_proxy', |
139 | 139 | 'url' => $fulltext['url'], |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if ($iiif instanceof ManifestInterface) { |
198 | 198 | $canvas = $iiif->getContainedResourceById($canvasId); |
199 | 199 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
200 | - if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
200 | + if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
201 | 201 | $annotationContainers = []; |
202 | 202 | /* |
203 | 203 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
208 | 208 | */ |
209 | 209 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
210 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
210 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
211 | 211 | foreach ($textAnnotations as $annotation) { |
212 | 212 | if ( |
213 | 213 | $annotation->getBody()->getFormat() == 'text/plain' |
214 | - && $annotation->getBody()->getChars() != null |
|
214 | + && $annotation->getBody()->getChars() != NULL |
|
215 | 215 | ) { |
216 | 216 | $annotationListData = []; |
217 | 217 | $annotationListData['uri'] = $annotationContainer->getId(); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // Configure @action URL for form. |
260 | 260 | $uri = $this->uriBuilder->reset() |
261 | 261 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
262 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
262 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
263 | 263 | ->setArguments([ |
264 | 264 | 'eID' => 'tx_dlf_pageview_proxy', |
265 | 265 | 'url' => $image['url'], |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | $fulltext['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpFulltext]); |
147 | 147 | break; |
148 | 148 | } else { |
149 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
149 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | if (empty($fulltext)) { |
153 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->extConf['fileGrpFulltext'] . '"'); |
|
153 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->extConf['fileGrpFulltext'].'"'); |
|
154 | 154 | } |
155 | 155 | return $fulltext; |
156 | 156 | } |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | $viewerConfiguration = '$(document).ready(function() { |
169 | 169 | if (dlfUtils.exists(dlfViewer)) { |
170 | 170 | tx_dlf_viewer = new dlfViewer({ |
171 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
172 | - div: "' . $this->settings['elementId'] . '", |
|
173 | - progressElementId: "' . $this->settings['progressElementId'] . '", |
|
174 | - images: ' . json_encode($this->images) . ', |
|
175 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
176 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
177 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ' |
|
171 | + controls: ["' . implode('", "', $this->controls).'"], |
|
172 | + div: "' . $this->settings['elementId'].'", |
|
173 | + progressElementId: "' . $this->settings['progressElementId'].'", |
|
174 | + images: ' . json_encode($this->images).', |
|
175 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
176 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
177 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).' |
|
178 | 178 | }); |
179 | 179 | } |
180 | 180 | });'; |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | } |
276 | 276 | break; |
277 | 277 | } else { |
278 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
278 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | if (empty($image)) { |
282 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->extConf['fileGrpImages'] . '"'); |
|
282 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->extConf['fileGrpImages'].'"'); |
|
283 | 283 | } |
284 | 284 | return $image; |
285 | 285 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
163 | 163 | if ($this->settings['suggest']) { |
164 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
164 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $this->view->assign('viewData', $this->viewData); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | // Get facets from plugin configuration. |
185 | 185 | $facets = []; |
186 | 186 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
187 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
187 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | $searchParams = $this->searchParams; |
227 | 227 | if ( |
228 | 228 | (!empty($searchParams['fulltext'])) |
229 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
229 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
230 | 230 | ) { |
231 | 231 | // If the query already is a fulltext query e.g using the facets |
232 | 232 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
233 | 233 | // Search in fulltext field if applicable. Query must not be empty! |
234 | 234 | if (!empty($this->searchParams['query'])) { |
235 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
235 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
236 | 236 | } |
237 | 237 | } else { |
238 | 238 | // Retain given search field if valid. |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
257 | 257 | ) { |
258 | 258 | if (!empty($search['query'])) { |
259 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
259 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
260 | 260 | } |
261 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
261 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $entryArray['doNotLinkIt'] = 0; |
384 | 384 | // Check if facet is already selected. |
385 | 385 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
386 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
386 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
387 | 387 | if ($index !== false) { |
388 | 388 | // Facet is selected, thus remove it from filter. |
389 | 389 | unset($queryColumn[$index]); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | } |
398 | 398 | } else { |
399 | 399 | // Facet is not selected, thus add it to filter. |
400 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
400 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
401 | 401 | $entryArray['ITEM_STATE'] = 'NO'; |
402 | 402 | } |
403 | 403 | $entryArray['queryColumn'] = $queryColumn; |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class SearchController extends AbstractController |
|
36 | -{ |
|
35 | +class SearchController extends AbstractController { |
|
37 | 36 | /** |
38 | 37 | * @var CollectionRepository |
39 | 38 | */ |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | /** |
43 | 42 | * @param CollectionRepository $collectionRepository |
44 | 43 | */ |
45 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
46 | - { |
|
44 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
47 | 45 | $this->collectionRepository = $collectionRepository; |
48 | 46 | } |
49 | 47 | |
@@ -55,8 +53,7 @@ discard block |
||
55 | 53 | /** |
56 | 54 | * @param MetadataRepository $metadataRepository |
57 | 55 | */ |
58 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
59 | - { |
|
56 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
60 | 57 | $this->metadataRepository = $metadataRepository; |
61 | 58 | } |
62 | 59 | |
@@ -71,8 +68,7 @@ discard block |
||
71 | 68 | * |
72 | 69 | * @return void |
73 | 70 | */ |
74 | - public function searchAction() |
|
75 | - { |
|
71 | + public function searchAction() { |
|
76 | 72 | // if search was triggered, get search parameters from POST variables |
77 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
78 | 74 | |
@@ -87,8 +83,7 @@ discard block |
||
87 | 83 | * |
88 | 84 | * @return void |
89 | 85 | */ |
90 | - public function mainAction() |
|
91 | - { |
|
86 | + public function mainAction() { |
|
92 | 87 | $listViewSearch = false; |
93 | 88 | // Quit without doing anything if required variables are not set. |
94 | 89 | if (empty($this->settings['solrcore'])) { |
@@ -174,8 +169,7 @@ discard block |
||
174 | 169 | * |
175 | 170 | * @return string HTML output of facets menu |
176 | 171 | */ |
177 | - protected function addFacetsMenu() |
|
178 | - { |
|
172 | + protected function addFacetsMenu() { |
|
179 | 173 | // Quit without doing anything if no facets are configured. |
180 | 174 | if (empty($this->settings['facets']) && empty($this->settings['facetCollections'])) { |
181 | 175 | return ''; |
@@ -200,8 +194,7 @@ discard block |
||
200 | 194 | * |
201 | 195 | * @return array HMENU array |
202 | 196 | */ |
203 | - public function makeFacetsMenuArray($facets) |
|
204 | - { |
|
197 | + public function makeFacetsMenuArray($facets) { |
|
205 | 198 | $menuArray = []; |
206 | 199 | // Set default value for facet search. |
207 | 200 | $search = [ |
@@ -360,8 +353,7 @@ discard block |
||
360 | 353 | * |
361 | 354 | * @return array The array for the facet's menu entry |
362 | 355 | */ |
363 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
364 | - { |
|
356 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
365 | 357 | $entryArray = []; |
366 | 358 | // Translate value. |
367 | 359 | if ($field == 'owner_faceting') { |
@@ -412,8 +404,7 @@ discard block |
||
412 | 404 | * |
413 | 405 | * @return string The extended search form or an empty string |
414 | 406 | */ |
415 | - protected function addExtendedSearch() |
|
416 | - { |
|
407 | + protected function addExtendedSearch() { |
|
417 | 408 | // Quit without doing anything if no fields for extended search are selected. |
418 | 409 | if ( |
419 | 410 | empty($this->settings['extendedSlotCount']) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
78 | 78 | |
79 | 79 | // output is done by main action |
80 | - $this->forward('main', null, null, ['searchParameter' => $this->searchParams]); |
|
80 | + $this->forward('main', NULL, NULL, ['searchParameter' => $this->searchParams]); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function mainAction() |
91 | 91 | { |
92 | - $listViewSearch = false; |
|
92 | + $listViewSearch = FALSE; |
|
93 | 93 | // Quit without doing anything if required variables are not set. |
94 | 94 | if (empty($this->settings['solrcore'])) { |
95 | 95 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
105 | 105 | $this->searchParams = array_merge($this->searchParams ? : [], $listRequestData['searchParameter']); |
106 | - $listViewSearch = true; |
|
106 | + $listViewSearch = TRUE; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // Pagination of Results: Pass the currentPage to the fluid template to calculate current index of search result. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | // If a targetPid is given, the results will be shown by ListView on the target page. |
116 | 116 | if (!empty($this->settings['targetPid']) && !empty($this->searchParams) && !$listViewSearch) { |
117 | - $this->redirect('main', 'ListView', null, |
|
117 | + $this->redirect('main', 'ListView', NULL, |
|
118 | 118 | [ |
119 | 119 | 'searchParameter' => $this->searchParams, |
120 | 120 | 'widgetPage' => $widgetPage |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | // If no search has been executed, no variables habe to be prepared. An empty form will be shown. |
126 | 126 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
127 | 127 | // get all sortable metadata records |
128 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
128 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
129 | 129 | |
130 | 130 | // get all metadata records to be shown in results |
131 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
131 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
132 | 132 | |
133 | 133 | $solrResults = []; |
134 | 134 | $numResults = 0; |
135 | 135 | // Do not execute the Solr search if used together with ListView plugin. |
136 | 136 | if (!$listViewSearch) { |
137 | - $solrResults = $this->documentRepository->findSolrByCollection(null, $this->settings, $this->searchParams, $listedMetadata); |
|
137 | + $solrResults = $this->documentRepository->findSolrByCollection(NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
138 | 138 | $numResults = $solrResults->getNumFound(); |
139 | 139 | } |
140 | 140 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | // Get facets from plugin configuration. |
185 | 185 | $facets = []; |
186 | - foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
|
186 | + foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], TRUE) as $facet) { |
|
187 | 187 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
188 | 188 | } |
189 | 189 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | // Check if facet is already selected. |
385 | 385 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
386 | 386 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
387 | - if ($index !== false) { |
|
387 | + if ($index !== FALSE) { |
|
388 | 388 | // Facet is selected, thus remove it from filter. |
389 | 389 | unset($queryColumn[$index]); |
390 | 390 | $queryColumn = array_values($queryColumn); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $state = 'ACTIFSUB'; |
393 | 393 | // Reset facets |
394 | 394 | if ($this->settings['resetFacets']) { |
395 | - $entryArray['resetFacet'] = true; |
|
395 | + $entryArray['resetFacet'] = TRUE; |
|
396 | 396 | $entryArray['queryColumn'] = $queryColumn; |
397 | 397 | } |
398 | 398 | } else { |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | // Get field selector options. |
426 | - $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], true); |
|
426 | + $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], TRUE); |
|
427 | 427 | |
428 | 428 | $slotCountArray = []; |
429 | 429 | for ($i = 0; $i < $this->settings['extendedSlotCount']; $i++) { |
@@ -5,10 +5,8 @@ |
||
5 | 5 | use Kitodo\Dlf\Common\Helper; |
6 | 6 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
7 | 7 | |
8 | -class HelperTest extends UnitTestCase |
|
9 | -{ |
|
10 | - public function assertInvalidXml($xml) |
|
11 | - { |
|
8 | +class HelperTest extends UnitTestCase { |
|
9 | + public function assertInvalidXml($xml) { |
|
12 | 10 | $result = Helper::getXmlFileAsString($xml); |
13 | 11 | $this->assertEquals(false, $result); |
14 | 12 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | public function assertInvalidXml($xml) |
11 | 11 | { |
12 | 12 | $result = Helper::getXmlFileAsString($xml); |
13 | - $this->assertEquals(false, $result); |
|
13 | + $this->assertEquals(FALSE, $result); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function invalidXmlYieldsFalse(): void |
21 | 21 | { |
22 | - $this->assertInvalidXml(false); |
|
23 | - $this->assertInvalidXml(null); |
|
22 | + $this->assertInvalidXml(FALSE); |
|
23 | + $this->assertInvalidXml(NULL); |
|
24 | 24 | $this->assertInvalidXml(1); |
25 | 25 | $this->assertInvalidXml([]); |
26 | 26 | $this->assertInvalidXml(new \stdClass()); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | <root> |
41 | 41 | <single /> |
42 | 42 | </root> |
43 | -XML; |
|
43 | +xml; |
|
44 | 44 | $node = Helper::getXmlFileAsString($xml); |
45 | 45 | $this->assertIsObject($node); |
46 | 46 | $this->assertEquals('root', $node->getName()); |