@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | try |
| 134 | 134 | {
|
| 135 | 135 | $xFilesystem->createDirectory($sUploadDir); |
| 136 | - if(!$xFilesystem->directoryExists($sUploadDir)) |
|
| 136 | + if (!$xFilesystem->directoryExists($sUploadDir)) |
|
| 137 | 137 | {
|
| 138 | 138 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
| 139 | 139 | } |
| 140 | 140 | return $sUploadDir; |
| 141 | 141 | } |
| 142 | - catch(FilesystemException $e) |
|
| 142 | + catch (FilesystemException $e) |
|
| 143 | 143 | {
|
| 144 | 144 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 145 | 145 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | {
|
| 174 | 174 | // Check the uploaded file validity |
| 175 | 175 | $nErrorCode = $xHttpFile->getError(); |
| 176 | - if($nErrorCode !== UPLOAD_ERR_OK) |
|
| 176 | + if ($nErrorCode !== UPLOAD_ERR_OK) |
|
| 177 | 177 | {
|
| 178 | 178 | $this->xLogger->error('File upload error.', [
|
| 179 | 179 | 'code' => $nErrorCode, |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | // Filename without the extension. Needs to be sanitized. |
| 186 | 186 | $sName = pathinfo($xHttpFile->getClientFilename(), PATHINFO_FILENAME); |
| 187 | - if($this->cNameSanitizer !== null) |
|
| 187 | + if ($this->cNameSanitizer !== null) |
|
| 188 | 188 | {
|
| 189 | 189 | $sName = (string)call_user_func($this->cNameSanitizer, $sName, $sField, $this->sUploadFieldId); |
| 190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | // Set the user file data |
| 193 | 193 | $xFile = File::fromHttpFile($this->xFileStorage->filesystem($sField), $xHttpFile, $sUploadDir, $sName); |
| 194 | 194 | // Verify file validity (format, size) |
| 195 | - if(!$this->xValidator->validateUploadedFile($sField, $xFile)) |
|
| 195 | + if (!$this->xValidator->validateUploadedFile($sField, $xFile)) |
|
| 196 | 196 | {
|
| 197 | 197 | throw new RequestException($this->xValidator->getErrorMessage()); |
| 198 | 198 | } |
@@ -217,16 +217,16 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | $aUserFiles = []; |
| 219 | 219 | $this->aAllFiles = []; // A flat list of all uploaded files |
| 220 | - foreach($aTempFiles as $sField => $aFiles) |
|
| 220 | + foreach ($aTempFiles as $sField => $aFiles) |
|
| 221 | 221 | {
|
| 222 | 222 | $aUserFiles[$sField] = []; |
| 223 | 223 | // Get the path to the upload dir |
| 224 | 224 | $sUploadDir = $this->getUploadDir($sField); |
| 225 | - if(!is_array($aFiles)) |
|
| 225 | + if (!is_array($aFiles)) |
|
| 226 | 226 | {
|
| 227 | 227 | $aFiles = [$aFiles]; |
| 228 | 228 | } |
| 229 | - foreach($aFiles as $xHttpFile) |
|
| 229 | + foreach ($aFiles as $xHttpFile) |
|
| 230 | 230 | {
|
| 231 | 231 | $aUserFiles[$sField][] = $this->makeUploadedFile($xHttpFile, $sUploadDir, $sField); |
| 232 | 232 | } |
@@ -234,12 +234,12 @@ discard block |
||
| 234 | 234 | // Copy the uploaded files from the temp dir to the user dir |
| 235 | 235 | try |
| 236 | 236 | {
|
| 237 | - foreach($this->aAllFiles as $aFiles) |
|
| 237 | + foreach ($this->aAllFiles as $aFiles) |
|
| 238 | 238 | {
|
| 239 | 239 | $aFiles['user']->filesystem()->write($aFiles['user']->path(), $aFiles['temp']->getStream()); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | - catch(FilesystemException $e) |
|
| 242 | + catch (FilesystemException $e) |
|
| 243 | 243 | {
|
| 244 | 244 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 245 | 245 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|