@@ -33,8 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @access public |
35 | 35 | */ |
36 | -class DataHandler implements LoggerAwareInterface |
|
37 | -{ |
|
36 | +class DataHandler implements LoggerAwareInterface { |
|
38 | 37 | use LoggerAwareTrait; |
39 | 38 | |
40 | 39 | /** |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | ) { |
126 | 126 | // Get current configuration. |
127 | 127 | $result = $queryBuilder |
128 | - ->select($table . '.is_listed AS is_listed') |
|
128 | + ->select($table.'.is_listed AS is_listed') |
|
129 | 129 | ->from($table) |
130 | 130 | ->where( |
131 | - $queryBuilder->expr()->eq($table . '.uid', (int) $id), |
|
131 | + $queryBuilder->expr()->eq($table.'.uid', (int) $id), |
|
132 | 132 | Helper::whereExpression($table) |
133 | 133 | ) |
134 | 134 | ->setMaxResults(1) |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | ) { |
152 | 152 | // Get current configuration. |
153 | 153 | $result = $queryBuilder |
154 | - ->select($table . '.index_autocomplete AS index_autocomplete') |
|
154 | + ->select($table.'.index_autocomplete AS index_autocomplete') |
|
155 | 155 | ->from($table) |
156 | 156 | ->where( |
157 | - $queryBuilder->expr()->eq($table . '.uid', (int) $id), |
|
157 | + $queryBuilder->expr()->eq($table.'.uid', (int) $id), |
|
158 | 158 | Helper::whereExpression($table) |
159 | 159 | ) |
160 | 160 | ->setMaxResults(1) |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | if ($solr->ready) { |
325 | 325 | // Delete Solr document. |
326 | 326 | $updateQuery = $solr->service->createUpdate(); |
327 | - $updateQuery->addDeleteQuery('uid:' . (int) $id); |
|
327 | + $updateQuery->addDeleteQuery('uid:'.(int) $id); |
|
328 | 328 | $updateQuery->addCommit(false); |
329 | 329 | $solr->service->update($updateQuery); |
330 | 330 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $document->setCurrentDocument($doc); |
349 | 349 | Indexer::add($document, $documentRepository); |
350 | 350 | } else { |
351 | - $this->logger->error('Failed to re-index document with UID ' . (string) $id); |
|
351 | + $this->logger->error('Failed to re-index document with UID '.(string) $id); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | try { |
400 | 400 | $response = $solr->service->coreAdmin($query); |
401 | 401 | if ($response->getWasSuccessful() == false) { |
402 | - $this->logger->warning('Core ' . $resArray['core'] . ' could not be deleted from Apache Solr'); |
|
402 | + $this->logger->warning('Core '.$resArray['core'].' could not be deleted from Apache Solr'); |
|
403 | 403 | } |
404 | 404 | } catch (\Exception $e) { |
405 | 405 | $this->logger->warning($e->getMessage()); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | // Delete Solr document. |
326 | 326 | $updateQuery = $solr->service->createUpdate(); |
327 | 327 | $updateQuery->addDeleteQuery('uid:' . (int) $id); |
328 | - $updateQuery->addCommit(false); |
|
328 | + $updateQuery->addCommit(FALSE); |
|
329 | 329 | $solr->service->update($updateQuery); |
330 | 330 | } |
331 | 331 | } |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | { |
344 | 344 | $documentRepository = GeneralUtility::makeInstance(DocumentRepository::class); |
345 | 345 | $document = $documentRepository->findByUid((int) $id); |
346 | - $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $document->getPid()], true); |
|
347 | - if ($document !== null && $doc !== null) { |
|
346 | + $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $document->getPid()], TRUE); |
|
347 | + if ($document !== NULL && $doc !== NULL) { |
|
348 | 348 | $document->setCurrentDocument($doc); |
349 | 349 | Indexer::add($document, $documentRepository); |
350 | 350 | } else { |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | $query = $solr->service->createCoreAdmin(); |
393 | 393 | $action = $query->createUnload(); |
394 | 394 | $action->setCore($resArray['core']); |
395 | - $action->setDeleteDataDir(true); |
|
396 | - $action->setDeleteIndex(true); |
|
397 | - $action->setDeleteInstanceDir(true); |
|
395 | + $action->setDeleteDataDir(TRUE); |
|
396 | + $action->setDeleteIndex(TRUE); |
|
397 | + $action->setDeleteInstanceDir(TRUE); |
|
398 | 398 | $query->setAction($action); |
399 | 399 | try { |
400 | 400 | $response = $solr->service->coreAdmin($query); |
401 | - if ($response->getWasSuccessful() == false) { |
|
401 | + if ($response->getWasSuccessful() == FALSE) { |
|
402 | 402 | $this->logger->warning('Core ' . $resArray['core'] . ' could not be deleted from Apache Solr'); |
403 | 403 | } |
404 | 404 | } catch (\Exception $e) { |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | $dmdIds = explode(' ', $id); |
59 | 59 | foreach ($dmdIds as $dmdId) { |
60 | - $recordIds = $xml->xpath('//mets:dmdSec[@ID="' . $dmdId . '"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
|
60 | + $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$dmdId.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
|
61 | 61 | if (!empty($recordIds)) { |
62 | 62 | $recordId = (string) $recordIds[0]; |
63 | 63 | break; |
@@ -20,8 +20,7 @@ |
||
20 | 20 | * |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class KitodoProductionHacks |
|
24 | -{ |
|
23 | +class KitodoProductionHacks { |
|
25 | 24 | /** |
26 | 25 | * Hook for \Kitodo\Dlf\Common\MetsDocument::establishRecordId() |
27 | 26 | * When using Kitodo.Production the record identifier is saved only in MODS, but not |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class ConfigurationForm |
|
28 | -{ |
|
27 | +class ConfigurationForm { |
|
29 | 28 | |
30 | 29 | /** |
31 | 30 | * Check if a connection to a Solr server could be established with the given credentials. |
@@ -60,8 +59,7 @@ discard block |
||
60 | 59 | * |
61 | 60 | * @return void |
62 | 61 | */ |
63 | - public function __construct() |
|
64 | - { |
|
62 | + public function __construct() { |
|
65 | 63 | // Load backend localization file. |
66 | 64 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
67 | 65 | } |
@@ -29,8 +29,7 @@ |
||
29 | 29 | * |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class ItemsProcFunc implements LoggerAwareInterface |
|
33 | -{ |
|
32 | +class ItemsProcFunc implements LoggerAwareInterface { |
|
34 | 33 | use LoggerAwareTrait; |
35 | 34 | |
36 | 35 | /** |
@@ -155,8 +155,8 @@ |
||
155 | 155 | ->select(...explode(',', $fields)) |
156 | 156 | ->from($table) |
157 | 157 | ->where( |
158 | - $queryBuilder->expr()->eq($table . '.pid', $this->storagePid), |
|
159 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
158 | + $queryBuilder->expr()->eq($table.'.pid', $this->storagePid), |
|
159 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
160 | 160 | $andWhere |
161 | 161 | ) |
162 | 162 | ->orderBy($sorting) |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | $queryBuilder->createNamedParameter('', \PDO::PARAM_STR) |
191 | 191 | ), |
192 | 192 | $queryBuilder->expr()->comparison( |
193 | - 'CAST(CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS DECIMAL) AS CHAR)', |
|
193 | + 'CAST(CAST('.$queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]).' AS DECIMAL) AS CHAR)', |
|
194 | 194 | ExpressionBuilder::NEQ, |
195 | - 'CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS CHAR)' |
|
195 | + 'CAST('.$queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]).' AS CHAR)' |
|
196 | 196 | ) |
197 | 197 | ) |
198 | 198 | ->orderBy('uid') |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | } catch (Exception $e) { |
207 | 207 | throw new \RuntimeException( |
208 | - 'Database query failed. Error was: ' . $e->getPrevious()->getMessage(), |
|
208 | + 'Database query failed. Error was: '.$e->getPrevious()->getMessage(), |
|
209 | 209 | 1511950673 |
210 | 210 | ); |
211 | 211 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
272 | 272 | |
273 | 273 | $fileUid = null; |
274 | - $sourcePath = Environment::getPublicPath() . '/' . $fieldItem; |
|
274 | + $sourcePath = Environment::getPublicPath().'/'.$fieldItem; |
|
275 | 275 | |
276 | 276 | // maybe the file was already moved, so check if the original file still exists |
277 | 277 | if (file_exists($sourcePath)) { |
@@ -171,8 +171,7 @@ |
||
171 | 171 | * |
172 | 172 | * @throws \RuntimeException |
173 | 173 | */ |
174 | - protected function getRecordsFromTable(bool $countOnly = false) |
|
175 | - { |
|
174 | + protected function getRecordsFromTable(bool $countOnly = false) { |
|
176 | 175 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
177 | 176 | $allResults = []; |
178 | 177 | $numResults = 0; |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | public function updateNecessary(): bool |
106 | 106 | { |
107 | 107 | /** @var int */ |
108 | - $numRecords = $this->getRecordsFromTable(true); |
|
108 | + $numRecords = $this->getRecordsFromTable(TRUE); |
|
109 | 109 | if ($numRecords > 0) { |
110 | - return true; |
|
110 | + return TRUE; |
|
111 | 111 | } |
112 | - return false; |
|
112 | + return FALSE; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function executeUpdate(): bool |
147 | 147 | { |
148 | - $result = true; |
|
148 | + $result = TRUE; |
|
149 | 149 | try { |
150 | 150 | /** @var int */ |
151 | - $numRecords = $this->getRecordsFromTable(true); |
|
151 | + $numRecords = $this->getRecordsFromTable(TRUE); |
|
152 | 152 | if ($numRecords > 0) { |
153 | 153 | $this->performUpdate(); |
154 | 154 | } |
155 | 155 | } catch (\Exception $e) { |
156 | 156 | // If something goes wrong, migrateField() logs an error |
157 | - $result = false; |
|
157 | + $result = FALSE; |
|
158 | 158 | } |
159 | 159 | return $result; |
160 | 160 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @throws \RuntimeException |
173 | 173 | */ |
174 | - protected function getRecordsFromTable(bool $countOnly = false) |
|
174 | + protected function getRecordsFromTable(bool $countOnly = FALSE) |
|
175 | 175 | { |
176 | 176 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
177 | 177 | $allResults = []; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | ->orderBy('uid') |
199 | 199 | ->execute() |
200 | 200 | ->fetchAllAssociative(); |
201 | - if ($countOnly === true) { |
|
201 | + if ($countOnly === TRUE) { |
|
202 | 202 | $numResults += count($result); |
203 | 203 | } else { |
204 | 204 | $allResults[$table] = $result; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | - if ($countOnly === true) { |
|
214 | + if ($countOnly === TRUE) { |
|
215 | 215 | return $numResults; |
216 | 216 | } else { |
217 | 217 | return $allResults; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function performUpdate(): bool |
230 | 230 | { |
231 | - $result = true; |
|
231 | + $result = TRUE; |
|
232 | 232 | |
233 | 233 | try { |
234 | 234 | $storages = GeneralUtility::makeInstance(StorageRepository::class)->findAll(); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | } |
243 | 243 | } catch (\Exception $e) { |
244 | - $result = false; |
|
244 | + $result = FALSE; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $result; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $storageUid = (int) $this->storage->getUid(); |
271 | 271 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
272 | 272 | |
273 | - $fileUid = null; |
|
273 | + $fileUid = NULL; |
|
274 | 274 | $sourcePath = Environment::getPublicPath() . '/' . $fieldItem; |
275 | 275 | |
276 | 276 | // maybe the file was already moved, so check if the original file still exists |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @access public |
24 | 24 | */ |
25 | -class DocumentTypeProvider extends AbstractProvider |
|
26 | -{ |
|
25 | +class DocumentTypeProvider extends AbstractProvider { |
|
27 | 26 | /** |
28 | 27 | * Construct the instance |
29 | 28 | * |
@@ -31,8 +30,7 @@ discard block |
||
31 | 30 | * |
32 | 31 | * @return void |
33 | 32 | */ |
34 | - public function __construct() |
|
35 | - { |
|
33 | + public function __construct() { |
|
36 | 34 | $this->expressionLanguageProviders = [ |
37 | 35 | DocumentTypeFunctionProvider::class |
38 | 36 | ]; |
@@ -116,12 +116,10 @@ |
||
116 | 116 | { |
117 | 117 | return new ExpressionFunction( |
118 | 118 | 'getDocumentType', |
119 | - function() |
|
120 | - { |
|
119 | + function() { |
|
121 | 120 | // Not implemented, we only use the evaluator |
122 | 121 | }, |
123 | - function($arguments, $cPid) |
|
124 | - { |
|
122 | + function($arguments, $cPid) { |
|
125 | 123 | /** @var RequestWrapper $requestWrapper */ |
126 | 124 | $requestWrapper = $arguments['request']; |
127 | 125 | $queryParams = $requestWrapper->getQueryParams(); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | if ($this->document) { |
180 | 180 | $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
181 | 181 | } else { |
182 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
182 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
183 | 183 | } |
184 | 184 | } elseif (GeneralUtility::isValidUrl($requestData['id'])) { |
185 | 185 | $doc = AbstractDocument::getInstance($requestData['id'], ['storagePid' => $pid], true); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | $this->document->setLocation($requestData['id']); |
195 | 195 | } else { |
196 | - $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
|
196 | + $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading'); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | if ($this->document !== null && $doc !== null) { |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | if ($doc !== null) { |
207 | 207 | $this->document->setCurrentDocument($doc); |
208 | 208 | } else { |
209 | - $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
|
209 | + $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"'); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | } else { |
213 | - $this->logger->error('Empty UID or invalid PID "' . $pid . '" for document loading'); |
|
213 | + $this->logger->error('Empty UID or invalid PID "'.$pid.'" for document loading'); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | // Load document with current plugin parameters. |
130 | 130 | $this->loadDocument($queryParams['tx_dlf'], $cPid); |
131 | - if (!isset($this->document) || $this->document->getCurrentDocument() === null) { |
|
131 | + if (!isset($this->document) || $this->document->getCurrentDocument() === NULL) { |
|
132 | 132 | return $type; |
133 | 133 | } |
134 | 134 | |
@@ -160,20 +160,20 @@ discard block |
||
160 | 160 | // Try to get document format from database |
161 | 161 | if (!empty($requestData['id'])) { |
162 | 162 | $this->initializeRepositories($pid); |
163 | - $doc = null; |
|
164 | - $this->document = null; |
|
163 | + $doc = NULL; |
|
164 | + $this->document = NULL; |
|
165 | 165 | if (MathUtility::canBeInterpretedAsInteger($requestData['id'])) { |
166 | 166 | // find document from repository by uid |
167 | 167 | $this->document = $this->documentRepository->findOneByIdAndSettings((int) $requestData['id'], ['storagePid' => $pid]); |
168 | 168 | if ($this->document) { |
169 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
169 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
170 | 170 | } else { |
171 | 171 | $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
172 | 172 | } |
173 | 173 | } elseif (GeneralUtility::isValidUrl($requestData['id'])) { |
174 | - $doc = AbstractDocument::getInstance($requestData['id'], ['storagePid' => $pid], true); |
|
174 | + $doc = AbstractDocument::getInstance($requestData['id'], ['storagePid' => $pid], TRUE); |
|
175 | 175 | |
176 | - if ($doc !== null) { |
|
176 | + if ($doc !== NULL) { |
|
177 | 177 | if ($doc->recordId) { |
178 | 178 | $this->document = $this->documentRepository->findOneByRecordId($doc->recordId); |
179 | 179 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
187 | 187 | } |
188 | 188 | } |
189 | - if ($this->document !== null && $doc !== null) { |
|
189 | + if ($this->document !== NULL && $doc !== NULL) { |
|
190 | 190 | $this->document->setCurrentDocument($doc); |
191 | 191 | } |
192 | 192 | } elseif (!empty($requestData['recordId'])) { |
193 | 193 | $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']); |
194 | - if ($this->document !== null) { |
|
195 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
196 | - if ($doc !== null) { |
|
194 | + if ($this->document !== NULL) { |
|
195 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
196 | + if ($doc !== NULL) { |
|
197 | 197 | $this->document->setCurrentDocument($doc); |
198 | 198 | } else { |
199 | 199 | $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
@@ -18,15 +18,13 @@ |
||
18 | 18 | use TYPO3\CMS\Core\Pagination\PaginatorInterface; |
19 | 19 | |
20 | 20 | |
21 | -final class PageGridPagination implements PaginationInterface |
|
22 | -{ |
|
21 | +final class PageGridPagination implements PaginationInterface { |
|
23 | 22 | /** |
24 | 23 | * @var PageGridPaginator |
25 | 24 | */ |
26 | 25 | protected $paginator; |
27 | 26 | |
28 | - public function __construct(PaginatorInterface $paginator) |
|
29 | - { |
|
27 | + public function __construct(PaginatorInterface $paginator) { |
|
30 | 28 | // @phpstan-ignore-next-line |
31 | 29 | $this->paginator = $paginator; |
32 | 30 | } |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | $previousPage = (int) (($this->paginator->getCurrentPageNumber() - 1) * $this->paginator->getPublicItemsPerPage()) - ($this->paginator->getPublicItemsPerPage() - 1); |
37 | 37 | |
38 | 38 | if ($previousPage > $this->paginator->getNumberOfPages()) { |
39 | - return null; |
|
39 | + return NULL; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $previousPage >= $this->getFirstPageNumber() |
43 | 43 | ? $previousPage |
44 | - : null |
|
44 | + : NULL |
|
45 | 45 | ; |
46 | 46 | } |
47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | return $nextPage <= $this->paginator->getNumberOfPages() |
53 | 53 | ? $nextPage |
54 | - : null |
|
54 | + : NULL |
|
55 | 55 | ; |
56 | 56 | } |
57 | 57 |
@@ -16,8 +16,7 @@ |
||
16 | 16 | |
17 | 17 | use TYPO3\CMS\Core\Pagination\AbstractPaginator; |
18 | 18 | |
19 | -final class PageGridPaginator extends AbstractPaginator |
|
20 | -{ |
|
19 | +final class PageGridPaginator extends AbstractPaginator { |
|
21 | 20 | /** |
22 | 21 | * @var array |
23 | 22 | */ |