@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * The TYPO3 project - inspiring people to share! |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | -class DocumentForm extends AbstractFormElement |
|
| 24 | -{ |
|
| 23 | +class DocumentForm extends AbstractFormElement { |
|
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * @var string CSRF token for this form |
@@ -103,8 +102,7 @@ discard block |
||
| 103 | 102 | * |
| 104 | 103 | * @param string $csrfToken |
| 105 | 104 | */ |
| 106 | - public function generateCsrfToken() |
|
| 107 | - { |
|
| 105 | + public function generateCsrfToken() { |
|
| 108 | 106 | $formProtection = FormProtectionFactory::get(); |
| 109 | 107 | $this->csrfToken = $formProtection->generateToken('DocumentForm', 'construct', 'DocumentForm'); |
| 110 | 108 | $formProtection->persistSessionToken(); |
@@ -119,10 +117,8 @@ discard block |
||
| 119 | 117 | * @throws Exception if the given string is empty. |
| 120 | 118 | * @throws TypeError if the given string is null |
| 121 | 119 | */ |
| 122 | - public function setCsrfToken(string $csrfToken) |
|
| 123 | - { |
|
| 124 | - if ($csrfToken === "") |
|
| 125 | - { |
|
| 120 | + public function setCsrfToken(string $csrfToken) { |
|
| 121 | + if ($csrfToken === "") { |
|
| 126 | 122 | throw new Exception("A forms CSRF token cannot be empty"); |
| 127 | 123 | } |
| 128 | 124 | $this->csrfToken = $csrfToken; |
@@ -134,8 +130,7 @@ discard block |
||
| 134 | 130 | * |
| 135 | 131 | * @return string CSRF token for this form |
| 136 | 132 | */ |
| 137 | - public function getCsrfToken() |
|
| 138 | - { |
|
| 133 | + public function getCsrfToken() { |
|
| 139 | 134 | return $this->csrfToken; |
| 140 | 135 | } |
| 141 | 136 | |
@@ -145,8 +140,7 @@ discard block |
||
| 145 | 140 | * |
| 146 | 141 | * @return bool True, is CSRF token is considered valid. False if the token is invalid or missing. |
| 147 | 142 | */ |
| 148 | - public function hasValidCsrfToken() |
|
| 149 | - { |
|
| 143 | + public function hasValidCsrfToken() { |
|
| 150 | 144 | $formProtection = FormProtectionFactory::get(); |
| 151 | 145 | return $formProtection->validateToken($this->csrfToken, 'DocumentForm', 'construct', 'DocumentForm'); |
| 152 | 146 | } |
@@ -155,8 +149,7 @@ discard block |
||
| 155 | 149 | * |
| 156 | 150 | * @return integer |
| 157 | 151 | */ |
| 158 | - public function getDocumentUid() |
|
| 159 | - { |
|
| 152 | + public function getDocumentUid() { |
|
| 160 | 153 | return $this->documentUid; |
| 161 | 154 | } |
| 162 | 155 | |
@@ -164,8 +157,7 @@ discard block |
||
| 164 | 157 | * |
| 165 | 158 | * @param integer $documentUid |
| 166 | 159 | */ |
| 167 | - public function setDocumentUid($documentUid) |
|
| 168 | - { |
|
| 160 | + public function setDocumentUid($documentUid) { |
|
| 169 | 161 | $this->documentUid = $documentUid; |
| 170 | 162 | } |
| 171 | 163 | |
@@ -173,8 +165,7 @@ discard block |
||
| 173 | 165 | * |
| 174 | 166 | * @return boolean |
| 175 | 167 | */ |
| 176 | - public function getPrimaryFileMandatory() |
|
| 177 | - { |
|
| 168 | + public function getPrimaryFileMandatory() { |
|
| 178 | 169 | return $this->primaryFileMandatory; |
| 179 | 170 | } |
| 180 | 171 | |
@@ -182,8 +173,7 @@ discard block |
||
| 182 | 173 | * |
| 183 | 174 | * @param boolean $primaryFileMandatory |
| 184 | 175 | */ |
| 185 | - public function setPrimaryFileMandatory($primaryFileMandatory) |
|
| 186 | - { |
|
| 176 | + public function setPrimaryFileMandatory($primaryFileMandatory) { |
|
| 187 | 177 | $this->primaryFileMandatory = boolval($primaryFileMandatory); |
| 188 | 178 | } |
| 189 | 179 | |
@@ -191,8 +181,7 @@ discard block |
||
| 191 | 181 | * |
| 192 | 182 | * @return string |
| 193 | 183 | */ |
| 194 | - public function getFedoraPid() |
|
| 195 | - { |
|
| 184 | + public function getFedoraPid() { |
|
| 196 | 185 | return $this->fedoraPid; |
| 197 | 186 | } |
| 198 | 187 | |
@@ -200,8 +189,7 @@ discard block |
||
| 200 | 189 | * |
| 201 | 190 | * @param string $fedoraPid |
| 202 | 191 | */ |
| 203 | - public function setFedoraPid($fedoraPid) |
|
| 204 | - { |
|
| 192 | + public function setFedoraPid($fedoraPid) { |
|
| 205 | 193 | $this->fedoraPid = $fedoraPid; |
| 206 | 194 | } |
| 207 | 195 | |
@@ -209,8 +197,7 @@ discard block |
||
| 209 | 197 | * |
| 210 | 198 | * @param type \EWW\Dpf\Domain\Model\File $primaryFile |
| 211 | 199 | */ |
| 212 | - public function setPrimaryFile($primaryFile) |
|
| 213 | - { |
|
| 200 | + public function setPrimaryFile($primaryFile) { |
|
| 214 | 201 | $this->primaryFile = $primaryFile; |
| 215 | 202 | } |
| 216 | 203 | |
@@ -218,59 +205,49 @@ discard block |
||
| 218 | 205 | * |
| 219 | 206 | * @return \EWW\Dpf\Domain\Model\File |
| 220 | 207 | */ |
| 221 | - public function getPrimaryFile() |
|
| 222 | - { |
|
| 208 | + public function getPrimaryFile() { |
|
| 223 | 209 | return $this->primaryFile; |
| 224 | 210 | } |
| 225 | 211 | |
| 226 | - public function setSecondaryFiles($secondaryFiles) |
|
| 227 | - { |
|
| 212 | + public function setSecondaryFiles($secondaryFiles) { |
|
| 228 | 213 | $this->secondaryFiles = $secondaryFiles; |
| 229 | 214 | } |
| 230 | 215 | |
| 231 | - public function getSecondaryFiles() |
|
| 232 | - { |
|
| 216 | + public function getSecondaryFiles() { |
|
| 233 | 217 | return $this->secondaryFiles; |
| 234 | 218 | } |
| 235 | 219 | |
| 236 | - public function getDeletedFiles() |
|
| 237 | - { |
|
| 220 | + public function getDeletedFiles() { |
|
| 238 | 221 | return $this->deletedFiles; |
| 239 | 222 | } |
| 240 | 223 | |
| 241 | - public function setDeletedFiles($deletedFiles) |
|
| 242 | - { |
|
| 224 | + public function setDeletedFiles($deletedFiles) { |
|
| 243 | 225 | $this->deletedFiles = $deletedFiles; |
| 244 | 226 | } |
| 245 | 227 | |
| 246 | - public function getNewFiles() |
|
| 247 | - { |
|
| 228 | + public function getNewFiles() { |
|
| 248 | 229 | return $this->newFiles; |
| 249 | 230 | } |
| 250 | 231 | |
| 251 | - public function setNewFiles($newFiles) |
|
| 252 | - { |
|
| 232 | + public function setNewFiles($newFiles) { |
|
| 253 | 233 | $this->newFiles = $newFiles; |
| 254 | 234 | } |
| 255 | 235 | |
| 256 | 236 | /** |
| 257 | 237 | * @return bool |
| 258 | 238 | */ |
| 259 | - public function getValid() |
|
| 260 | - { |
|
| 239 | + public function getValid() { |
|
| 261 | 240 | return $this->valid; |
| 262 | 241 | } |
| 263 | 242 | |
| 264 | 243 | /** |
| 265 | 244 | * @param bool $valid |
| 266 | 245 | */ |
| 267 | - public function setValid($valid) |
|
| 268 | - { |
|
| 246 | + public function setValid($valid) { |
|
| 269 | 247 | $this->valid = boolval($valid); |
| 270 | 248 | } |
| 271 | 249 | |
| 272 | - public function getNewFileNames() |
|
| 273 | - { |
|
| 250 | + public function getNewFileNames() { |
|
| 274 | 251 | $fileNames = array(); |
| 275 | 252 | foreach ($this->getNewFiles() as $file) { |
| 276 | 253 | $fileNames[] = $file->getTitle(); |
@@ -283,8 +260,7 @@ discard block |
||
| 283 | 260 | * |
| 284 | 261 | * @return string |
| 285 | 262 | */ |
| 286 | - public function getProcessNumber() |
|
| 287 | - { |
|
| 263 | + public function getProcessNumber() { |
|
| 288 | 264 | return $this->processNumber; |
| 289 | 265 | } |
| 290 | 266 | |
@@ -293,8 +269,7 @@ discard block |
||
| 293 | 269 | * |
| 294 | 270 | * @param string $processNumber |
| 295 | 271 | */ |
| 296 | - public function setProcessNumber($processNumber) |
|
| 297 | - { |
|
| 272 | + public function setProcessNumber($processNumber) { |
|
| 298 | 273 | $this->processNumber = $processNumber; |
| 299 | 274 | } |
| 300 | 275 | |
@@ -303,8 +278,7 @@ discard block |
||
| 303 | 278 | * |
| 304 | 279 | * @return bool |
| 305 | 280 | */ |
| 306 | - public function isTemporary() |
|
| 307 | - { |
|
| 281 | + public function isTemporary() { |
|
| 308 | 282 | return $this->temporary; |
| 309 | 283 | } |
| 310 | 284 | |
@@ -312,24 +286,21 @@ discard block |
||
| 312 | 286 | * Sets if a document is a temporary document or not. |
| 313 | 287 | * @param bool $temporary |
| 314 | 288 | */ |
| 315 | - public function setTemporary($temporary) |
|
| 316 | - { |
|
| 289 | + public function setTemporary($temporary) { |
|
| 317 | 290 | $this->temporary = boolval($temporary); |
| 318 | 291 | } |
| 319 | 292 | |
| 320 | 293 | /** |
| 321 | 294 | * @return string |
| 322 | 295 | */ |
| 323 | - public function getComment() |
|
| 324 | - { |
|
| 296 | + public function getComment() { |
|
| 325 | 297 | return $this->comment; |
| 326 | 298 | } |
| 327 | 299 | |
| 328 | 300 | /** |
| 329 | 301 | * @param string $comment |
| 330 | 302 | */ |
| 331 | - public function setComment($comment) |
|
| 332 | - { |
|
| 303 | + public function setComment($comment) { |
|
| 333 | 304 | $this->comment = $comment; |
| 334 | 305 | } |
| 335 | 306 | } |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | use EWW\Dpf\Domain\Workflow\DocumentWorkflow; |
| 21 | 21 | use EWW\Dpf\Services\ProcessNumber\ProcessNumberGenerator; |
| 22 | 22 | |
| 23 | -class DocumentMapper |
|
| 24 | -{ |
|
| 23 | +class DocumentMapper { |
|
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * objectManager |
@@ -91,8 +90,7 @@ discard block |
||
| 91 | 90 | * |
| 92 | 91 | * @return mixed |
| 93 | 92 | */ |
| 94 | - public function getSettings() |
|
| 95 | - { |
|
| 93 | + public function getSettings() { |
|
| 96 | 94 | $frameworkConfiguration = $this->configurationManager->getConfiguration( |
| 97 | 95 | \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK |
| 98 | 96 | ); |
@@ -106,8 +104,7 @@ discard block |
||
| 106 | 104 | * @param bool $generateEmptyFields |
| 107 | 105 | * @return \EWW\Dpf\Domain\Model\DocumentForm |
| 108 | 106 | */ |
| 109 | - public function getDocumentForm(Document $document, $generateEmptyFields = true) |
|
| 110 | - { |
|
| 107 | + public function getDocumentForm(Document $document, $generateEmptyFields = true) { |
|
| 111 | 108 | $documentForm = new \EWW\Dpf\Domain\Model\DocumentForm(); |
| 112 | 109 | $documentForm->generateCsrfToken(); |
| 113 | 110 | $documentForm->setUid($document->getDocumentType()->getUid()); |
@@ -344,8 +341,7 @@ discard block |
||
| 344 | 341 | return $documentForm; |
| 345 | 342 | } |
| 346 | 343 | |
| 347 | - public function getDocument($documentForm) |
|
| 348 | - { |
|
| 344 | + public function getDocument($documentForm) { |
|
| 349 | 345 | /** @var Document $document */ |
| 350 | 346 | |
| 351 | 347 | if ($documentForm->getDocumentUid()) { |
@@ -407,8 +403,7 @@ discard block |
||
| 407 | 403 | return $document; |
| 408 | 404 | } |
| 409 | 405 | |
| 410 | - public function getMetadata($documentForm) |
|
| 411 | - { |
|
| 406 | + public function getMetadata($documentForm) { |
|
| 412 | 407 | |
| 413 | 408 | foreach ($documentForm->getItems() as $page) { |
| 414 | 409 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @var \EWW\Dpf\Domain\Repository\MetadataGroupRepository |
| 45 | 45 | * @TYPO3\CMS\Extbase\Annotation\Inject |
| 46 | 46 | */ |
| 47 | - protected $metadataGroupRepository = null; |
|
| 47 | + protected $metadataGroupRepository = NULL; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * metadataObjectRepository |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @var \EWW\Dpf\Domain\Repository\MetadataObjectRepository |
| 53 | 53 | * @TYPO3\CMS\Extbase\Annotation\Inject |
| 54 | 54 | */ |
| 55 | - protected $metadataObjectRepository = null; |
|
| 55 | + protected $metadataObjectRepository = NULL; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * documentTypeRepository |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @var \EWW\Dpf\Domain\Repository\DocumentTypeRepository |
| 61 | 61 | * @TYPO3\CMS\Extbase\Annotation\Inject |
| 62 | 62 | */ |
| 63 | - protected $documentTypeRepository = null; |
|
| 63 | + protected $documentTypeRepository = NULL; |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * documentRepository |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @var \EWW\Dpf\Domain\Repository\DocumentRepository |
| 69 | 69 | * @TYPO3\CMS\Extbase\Annotation\Inject |
| 70 | 70 | */ |
| 71 | - protected $documentRepository = null; |
|
| 71 | + protected $documentRepository = NULL; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * fileRepository |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @var \EWW\Dpf\Domain\Repository\FileRepository |
| 77 | 77 | * @TYPO3\CMS\Extbase\Annotation\Inject |
| 78 | 78 | */ |
| 79 | - protected $fileRepository = null; |
|
| 79 | + protected $fileRepository = NULL; |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * depositLicenseRepository |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @var \EWW\Dpf\Domain\Repository\DepositLicenseRepository |
| 85 | 85 | * @TYPO3\CMS\Extbase\Annotation\Inject |
| 86 | 86 | */ |
| 87 | - protected $depositLicenseRepository = null; |
|
| 87 | + protected $depositLicenseRepository = NULL; |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Get typoscript settings |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param bool $generateEmptyFields |
| 107 | 107 | * @return \EWW\Dpf\Domain\Model\DocumentForm |
| 108 | 108 | */ |
| 109 | - public function getDocumentForm(Document $document, $generateEmptyFields = true) |
|
| 109 | + public function getDocumentForm(Document $document, $generateEmptyFields = TRUE) |
|
| 110 | 110 | { |
| 111 | 111 | $documentForm = new \EWW\Dpf\Domain\Model\DocumentForm(); |
| 112 | 112 | $documentForm->generateCsrfToken(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ( |
| 121 | 121 | $this->getSettings()['deactivatePrimaryFileMandatoryCheck'] || |
| 122 | 122 | $document->getDocumentType()->getVirtualType() |
| 123 | - )? false : true |
|
| 123 | + )? FALSE : TRUE |
|
| 124 | 124 | ) |
| 125 | 125 | ); |
| 126 | 126 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | // build mapping path, previous fixed attributes which are differ from |
| 184 | 184 | // the own fixed attributes are excluded |
| 185 | 185 | $queryGroupMapping = $metadataGroup->getAbsoluteMapping(); |
| 186 | - if (strpos($queryGroupMapping, "@displayLabel") === false && is_array($excludeGroupAttributes[$groupMappingName])) { |
|
| 186 | + if (strpos($queryGroupMapping, "@displayLabel") === FALSE && is_array($excludeGroupAttributes[$groupMappingName])) { |
|
| 187 | 187 | foreach ($excludeGroupAttributes[$groupMappingName] as $excludeAttr => $excludeAttrValue) { |
| 188 | 188 | if (!in_array($excludeAttr, $fixedGroupAttributes)) { |
| 189 | 189 | $queryGroupMapping .= $excludeAttrValue; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // ensure that e.g. <mods:detail> and <mods:detail type="volume"> |
| 243 | 243 | // are not recognized as the same node |
| 244 | - if ((strpos($value, "@") === false) && ($value != '.')) { |
|
| 244 | + if ((strpos($value, "@") === FALSE) && ($value != '.')) { |
|
| 245 | 245 | $objectMappingPath[$key] .= "[not(@*)]"; |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | } else { |
| 300 | 300 | |
| 301 | - $documentFormGroup->setEmptyGroup(true); |
|
| 301 | + $documentFormGroup->setEmptyGroup(TRUE); |
|
| 302 | 302 | |
| 303 | 303 | foreach ($metadataGroup->getMetadataObject() as $metadataObject) { |
| 304 | 304 | $documentFormField = new \EWW\Dpf\Domain\Model\DocumentFormField(); |