@@ -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 | /** |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class ThumbnailCustomElement extends AbstractFormElement |
|
| 26 | -{ |
|
| 25 | +class ThumbnailCustomElement extends AbstractFormElement { |
|
| 27 | 26 | |
| 28 | 27 | /** |
| 29 | 28 | * Renders thumbnail custom element. |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | * |
| 27 | 27 | * @internal |
| 28 | 28 | */ |
| 29 | -class MigrateSettings implements UpgradeWizardInterface |
|
| 30 | -{ |
|
| 29 | +class MigrateSettings implements UpgradeWizardInterface { |
|
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Return the identifier for this wizard |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // exit if at least one update statement is not successful |
| 110 | 110 | if (!((bool) $updateResult)) { |
| 111 | - return false; |
|
| 111 | + return FALSE; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - return true; |
|
| 115 | + return TRUE; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function updateNecessary(): bool |
| 128 | 128 | { |
| 129 | - $oldSettingsFound = false; |
|
| 129 | + $oldSettingsFound = FALSE; |
|
| 130 | 130 | |
| 131 | 131 | $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_content'); |
| 132 | 132 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // Update the found record sets |
| 145 | 145 | while ($record = $statement->fetchAssociative()) { |
| 146 | 146 | $oldSettingsFound = $this->checkForOldSettings($record['pi_flexform']); |
| 147 | - if ($oldSettingsFound === true) { |
|
| 147 | + if ($oldSettingsFound === TRUE) { |
|
| 148 | 148 | // We found at least one field to be updated --> break here |
| 149 | 149 | break; |
| 150 | 150 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | foreach ($fields as $field) { |
| 189 | 189 | // change the index attribute if it doesn't start with 'settings.' yet |
| 190 | - if (strpos($field['index'], 'settings.') === false) { |
|
| 190 | + if (strpos($field['index'], 'settings.') === FALSE) { |
|
| 191 | 191 | $field['index'] = 'settings.' . $field['index']; |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -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 | ]; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if ($this->document) { |
| 182 | 182 | $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
| 183 | 183 | } else { |
| 184 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
| 184 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
| 185 | 185 | } |
| 186 | 186 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
| 187 | 187 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $this->document->setLocation($requestData['id']); |
| 201 | 201 | } else { |
| 202 | - $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
|
| 202 | + $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading'); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | if ($doc !== null) { |
| 217 | 217 | $this->document->setCurrentDocument($doc); |
| 218 | 218 | } else { |
| 219 | - $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
|
| 219 | + $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"'); |
|
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | } else { |
| 223 | - $this->logger->error('Empty UID or invalid PID "' . $pid . '" for document loading'); |
|
| 223 | + $this->logger->error('Empty UID or invalid PID "'.$pid.'" for document loading'); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -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(); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // Load document with current plugin parameters. |
| 138 | 138 | $this->loadDocument($queryParams['tx_dlf'], $cPid); |
| 139 | - if ($this->document === null || $this->document->getCurrentDocument() === null) { |
|
| 139 | + if ($this->document === NULL || $this->document->getCurrentDocument() === NULL) { |
|
| 140 | 140 | return $type; |
| 141 | 141 | } |
| 142 | 142 | // Set PID for metadata definitions. |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types. |
| 148 | 148 | if ( |
| 149 | 149 | $this->document->getCurrentDocument() instanceof IiifManifest |
| 150 | - && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false |
|
| 150 | + && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE |
|
| 151 | 151 | ) { |
| 152 | 152 | return $type; |
| 153 | 153 | } |
@@ -174,25 +174,25 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $this->initializeRepositories($pid); |
| 176 | 176 | |
| 177 | - $doc = null; |
|
| 177 | + $doc = NULL; |
|
| 178 | 178 | if (MathUtility::canBeInterpretedAsInteger($requestData['id'])) { |
| 179 | 179 | // find document from repository by uid |
| 180 | 180 | $this->document = $this->documentRepository->findOneByIdAndSettings((int) $requestData['id'], ['storagePid' => $pid]); |
| 181 | 181 | if ($this->document) { |
| 182 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
| 182 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
| 183 | 183 | } else { |
| 184 | 184 | $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
| 185 | 185 | } |
| 186 | 186 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
| 187 | 187 | |
| 188 | - $doc = AbstractDocument::getInstance($requestData['id'], ['storagePid' => $pid], true); |
|
| 188 | + $doc = AbstractDocument::getInstance($requestData['id'], ['storagePid' => $pid], TRUE); |
|
| 189 | 189 | |
| 190 | - if ($doc !== null) { |
|
| 190 | + if ($doc !== NULL) { |
|
| 191 | 191 | if ($doc->recordId) { |
| 192 | 192 | $this->document = $this->documentRepository->findOneByRecordId($doc->recordId); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ($this->document === null) { |
|
| 195 | + if ($this->document === NULL) { |
|
| 196 | 196 | // create new dummy Document object |
| 197 | 197 | $this->document = GeneralUtility::makeInstance(Document::class); |
| 198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if ($this->document !== null && $doc !== null) { |
|
| 206 | + if ($this->document !== NULL && $doc !== NULL) { |
|
| 207 | 207 | $this->document->setCurrentDocument($doc); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']); |
| 213 | 213 | |
| 214 | - if ($this->document !== null) { |
|
| 215 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
| 216 | - if ($doc !== null) { |
|
| 214 | + if ($this->document !== NULL) { |
|
| 215 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
| 216 | + if ($doc !== NULL) { |
|
| 217 | 217 | $this->document->setCurrentDocument($doc); |
| 218 | 218 | } else { |
| 219 | 219 | $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 | */ |
@@ -145,11 +145,11 @@ discard block |
||
| 145 | 145 | if ($doc !== null) { |
| 146 | 146 | $this->document->setCurrentDocument($doc); |
| 147 | 147 | } else { |
| 148 | - $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"'); |
|
| 148 | + $this->logger->error('Failed to load document with record ID "'.$this->requestData['recordId'].'"'); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | } else { |
| 152 | - $this->logger->error('Invalid ID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
|
| 152 | + $this->logger->error('Invalid ID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading'); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | && !MathUtility::canBeInterpretedAsInteger($this->requestData['id']) |
| 246 | 246 | && !GeneralUtility::isValidUrl($this->requestData['id']) |
| 247 | 247 | ) { |
| 248 | - $this->logger->warning('Invalid ID or URI "' . $this->requestData['id'] . '" for document loading'); |
|
| 248 | + $this->logger->warning('Invalid ID or URI "'.$this->requestData['id'].'" for document loading'); |
|
| 249 | 249 | unset($this->requestData['id']); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $pages = []; |
| 332 | 332 | $pagesSect = []; |
| 333 | 333 | $aRange = []; |
| 334 | - $nRange = 5; // ToDo: should be made configurable |
|
| 334 | + $nRange = 5; // ToDo: should be made configurable |
|
| 335 | 335 | |
| 336 | 336 | // lower limit of the range |
| 337 | 337 | $nBottom = $currentPageNumber - $nRange; |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | // check whether the first screen page is > 1, if yes then points must be added |
| 348 | 348 | if ($aRange[0] > 1) { |
| 349 | - array_push($pagesSect, ['label' => '...','startRecordNumber' => '...']); |
|
| 349 | + array_push($pagesSect, ['label' => '...', 'startRecordNumber' => '...']); |
|
| 350 | 350 | }; |
| 351 | 351 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
| 352 | 352 | foreach (range($firstPage, $lastPage) as $i) { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | // Check if screen page is in range |
| 391 | 391 | if (in_array($i, $aRange)) { |
| 392 | - array_push($pagesSect, ['label' => $i,'startRecordNumber' => $startRecordNumber]); |
|
| 392 | + array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $startRecordNumber]); |
|
| 393 | 393 | }; |
| 394 | 394 | }; |
| 395 | 395 | }; |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | if ($this->document) { |
| 452 | 452 | $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
| 453 | 453 | } else { |
| 454 | - $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
|
| 454 | + $this->logger->error('Invalid UID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading'); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | return $doc; |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | |
| 490 | 490 | $this->document->setLocation($documentId); |
| 491 | 491 | } else { |
| 492 | - $this->logger->error('Invalid location given "' . $documentId . '" for document loading'); |
|
| 492 | + $this->logger->error('Invalid location given "'.$documentId.'" for document loading'); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | return $doc; |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @abstract |
| 37 | 37 | */ |
| 38 | -abstract class AbstractController extends ActionController implements LoggerAwareInterface |
|
| 39 | -{ |
|
| 38 | +abstract class AbstractController extends ActionController implements LoggerAwareInterface { |
|
| 40 | 39 | use LoggerAwareTrait; |
| 41 | 40 | |
| 42 | 41 | /** |
@@ -222,8 +221,7 @@ discard block |
||
| 222 | 221 | * |
| 223 | 222 | * @return null|string|array |
| 224 | 223 | */ |
| 225 | - protected function getParametersSafely(string $parameterName) |
|
| 226 | - { |
|
| 224 | + protected function getParametersSafely(string $parameterName) { |
|
| 227 | 225 | if ($this->request->hasArgument($parameterName)) { |
| 228 | 226 | return $this->request->getArgument($parameterName); |
| 229 | 227 | } |
@@ -310,8 +308,7 @@ discard block |
||
| 310 | 308 | * |
| 311 | 309 | * @return void |
| 312 | 310 | */ |
| 313 | - public function __construct() |
|
| 314 | - { |
|
| 311 | + public function __construct() { |
|
| 315 | 312 | $this->initialize(); |
| 316 | 313 | } |
| 317 | 314 | |
@@ -351,7 +348,8 @@ discard block |
||
| 351 | 348 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
| 352 | 349 | foreach (range($firstPage, $lastPage) as $i) { |
| 353 | 350 | // detect which pagination is active: ListView or GridView |
| 354 | - if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { // ListView |
|
| 351 | + if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { |
|
| 352 | +// ListView |
|
| 355 | 353 | $lastStartRecordNumberGrid = $i; // save last $startRecordNumber for LastPage button |
| 356 | 354 | |
| 357 | 355 | $pages[$i] = [ |
@@ -364,7 +362,8 @@ discard block |
||
| 364 | 362 | if (in_array($i, $aRange)) { |
| 365 | 363 | array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $i]); |
| 366 | 364 | }; |
| 367 | - } else { // GridView |
|
| 365 | + } else { |
|
| 366 | +// GridView |
|
| 368 | 367 | // to calculate the values for generation the links for the pagination pages |
| 369 | 368 | /** @var \Kitodo\Dlf\Pagination\PageGridPaginator $paginator */ |
| 370 | 369 | $itemsPerPage = $paginator->getPublicItemsPerPage(); |
@@ -443,8 +442,7 @@ discard block |
||
| 443 | 442 | * |
| 444 | 443 | * @return AbstractDocument |
| 445 | 444 | */ |
| 446 | - private function getDocumentByUid(int $documentId) |
|
| 447 | - { |
|
| 445 | + private function getDocumentByUid(int $documentId) { |
|
| 448 | 446 | $doc = null; |
| 449 | 447 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
| 450 | 448 | |
@@ -466,8 +464,7 @@ discard block |
||
| 466 | 464 | * |
| 467 | 465 | * @return AbstractDocument |
| 468 | 466 | */ |
| 469 | - private function getDocumentByUrl(string $documentId) |
|
| 470 | - { |
|
| 467 | + private function getDocumentByUrl(string $documentId) { |
|
| 471 | 468 | $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
| 472 | 469 | |
| 473 | 470 | if ($doc !== null) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @access protected |
| 62 | 62 | * @var Document|null This holds the current document |
| 63 | 63 | */ |
| 64 | - protected ?Document $document = null; |
|
| 64 | + protected ?Document $document = NULL; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @access protected |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | // Try to get document format from database |
| 132 | 132 | if (!empty($documentId)) { |
| 133 | 133 | |
| 134 | - $doc = null; |
|
| 134 | + $doc = NULL; |
|
| 135 | 135 | |
| 136 | 136 | if (MathUtility::canBeInterpretedAsInteger($documentId)) { |
| 137 | 137 | $doc = $this->getDocumentByUid($documentId); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $doc = $this->getDocumentByUrl($documentId); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ($this->document !== null && $doc !== null) { |
|
| 142 | + if ($this->document !== NULL && $doc !== NULL) { |
|
| 143 | 143 | $this->document->setCurrentDocument($doc); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $this->document = $this->documentRepository->findOneByRecordId($this->requestData['recordId']); |
| 149 | 149 | |
| 150 | - if ($this->document !== null) { |
|
| 151 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
|
| 152 | - if ($doc !== null) { |
|
| 150 | + if ($this->document !== NULL) { |
|
| 151 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE); |
|
| 152 | + if ($doc !== NULL) { |
|
| 153 | 153 | $this->document->setCurrentDocument($doc); |
| 154 | 154 | } else { |
| 155 | 155 | $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"'); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | protected function isDocMissing(): bool |
| 207 | 207 | { |
| 208 | - return $this->document === null || $this->document->getCurrentDocument() === null; |
|
| 208 | + return $this->document === NULL || $this->document->getCurrentDocument() === NULL; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | if ($this->request->hasArgument($parameterName)) { |
| 235 | 235 | return $this->request->getArgument($parameterName); |
| 236 | 236 | } |
| 237 | - return null; |
|
| 237 | + return NULL; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | }; |
| 409 | 409 | |
| 410 | 410 | // Safely get the next and previous page numbers |
| 411 | - $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : null; |
|
| 412 | - $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : null; |
|
| 411 | + $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : NULL; |
|
| 412 | + $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : NULL; |
|
| 413 | 413 | |
| 414 | 414 | // 'startRecordNumber' is not required in GridView, only the variant for each loop is required |
| 415 | 415 | // 'endRecordNumber' is not required in both views |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | private function getDocumentByUid(int $documentId) |
| 456 | 456 | { |
| 457 | - $doc = null; |
|
| 457 | + $doc = NULL; |
|
| 458 | 458 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
| 459 | 459 | |
| 460 | 460 | if ($this->document) { |
| 461 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
|
| 461 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE); |
|
| 462 | 462 | } else { |
| 463 | 463 | $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
| 464 | 464 | } |
@@ -477,13 +477,13 @@ discard block |
||
| 477 | 477 | */ |
| 478 | 478 | private function getDocumentByUrl(string $documentId) |
| 479 | 479 | { |
| 480 | - $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
|
| 480 | + $doc = AbstractDocument::getInstance($documentId, $this->settings, TRUE); |
|
| 481 | 481 | |
| 482 | - if ($doc !== null) { |
|
| 482 | + if ($doc !== NULL) { |
|
| 483 | 483 | if ($doc->recordId) { |
| 484 | 484 | // find document from repository by recordId |
| 485 | 485 | $docFromRepository = $this->documentRepository->findOneByRecordId($doc->recordId); |
| 486 | - if ($docFromRepository !== null) { |
|
| 486 | + if ($docFromRepository !== NULL) { |
|
| 487 | 487 | $this->document = $docFromRepository; |
| 488 | 488 | } else { |
| 489 | 489 | // create new dummy Document object |