@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | try { |
| 213 | 213 | // TODO: release lock |
| 214 | 214 | |
| 215 | - // returns user specific processed files |
|
| 215 | + // returns user specific processed files |
|
| 216 | 216 | $processed = $this->handleProcessed(); |
| 217 | 217 | |
| 218 | 218 | $pending = $this->statusMapper->findAllPending($this->userId); |
@@ -263,18 +263,18 @@ discard block |
||
| 263 | 263 | $status = $this->statusMapper->delete($status); |
| 264 | 264 | } |
| 265 | 265 | $status->setTarget($this->removeFileExtension($status)); |
| 266 | - $status->setSource(null); |
|
| 267 | - $status->setTempFile(null); |
|
| 268 | - $status->setType(null); |
|
| 269 | - $status->setErrorDisplayed(null); |
|
| 266 | + $status->setSource(null); |
|
| 267 | + $status->setTempFile(null); |
|
| 268 | + $status->setType(null); |
|
| 269 | + $status->setErrorDisplayed(null); |
|
| 270 | 270 | return $status; |
| 271 | 271 | } catch (Exception $e) { |
| 272 | - if ($e instanceof DoesNotExistException) { |
|
| 273 | - $ex = new NotFoundException($this->l10n->t('Cannot delete. Wrong id.')); |
|
| 274 | - $this->handleException($ex); |
|
| 275 | - } else { |
|
| 276 | - $this->handleException($e); |
|
| 277 | - } |
|
| 272 | + if ($e instanceof DoesNotExistException) { |
|
| 273 | + $ex = new NotFoundException($this->l10n->t('Cannot delete. Wrong id.')); |
|
| 274 | + $this->handleException($ex); |
|
| 275 | + } else { |
|
| 276 | + $this->handleException($e); |
|
| 277 | + } |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | * @return array |
| 286 | 286 | */ |
| 287 | 287 | public function getAllForPersonal($userId) { |
| 288 | - try { |
|
| 289 | - $status = $this->statusMapper->findAll($userId); |
|
| 290 | - $statusNew = array(); |
|
| 288 | + try { |
|
| 289 | + $status = $this->statusMapper->findAll($userId); |
|
| 290 | + $statusNew = array(); |
|
| 291 | 291 | for ($x = 0; $x < count($status); $x++) { |
| 292 | 292 | $newName = $this->removeFileExtension($status[$x]); |
| 293 | 293 | $status[$x]->setTarget($newName); |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | $status[$x]->setErrorDisplayed(null); |
| 298 | 298 | array_push($statusNew, $status[$x]); |
| 299 | 299 | } |
| 300 | - return $statusNew; |
|
| 301 | - } catch (Exception $e) { |
|
| 302 | - $this->handleException($e); |
|
| 303 | - } |
|
| 304 | - } |
|
| 300 | + return $statusNew; |
|
| 301 | + } catch (Exception $e) { |
|
| 302 | + $this->handleException($e); |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * Returns a not existing file name for pdf or image processing |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $source = $fInfo->getPath(); |
| 170 | 170 | if ($this->checkSharedWithInitiator($fInfo)) { |
| 171 | 171 | // Shared Item |
| 172 | - $source = str_replace('home::','',$fInfo->getStoragename()) . '/' . $source; |
|
| 172 | + $source = str_replace('home::', '', $fInfo->getStoragename()) . '/' . $source; |
|
| 173 | 173 | $target = $this->buildTargetForShared($fInfo); |
| 174 | 174 | } else { |
| 175 | 175 | // Not Shared |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | protected function buildTargetForShared(File $fileInfo) { |
| 315 | 315 | try { |
| 316 | - $share = $this->shareMapper->find($fileInfo->getFileid(), $this->userId, str_replace('home::','',$fileInfo->getStoragename())); |
|
| 316 | + $share = $this->shareMapper->find($fileInfo->getFileid(), $this->userId, str_replace('home::', '', $fileInfo->getStoragename())); |
|
| 317 | 317 | |
| 318 | 318 | // get rid of the .png or .pdf and so on |
| 319 | 319 | $fileName = substr($share->getFileTarget(), 0, -4); // '/thedom.png' => '/thedom' || '/Test/thedom.png' => '/Test/thedom' |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $filePath = str_replace('files', '', $filePath); // 'files/Test/' => '/Test/' || 'files/' => '/' |
| 363 | 363 | |
| 364 | 364 | // remove the last slash |
| 365 | - $filePath = substr_replace($filePath,'',strrpos($filePath,'/'),strlen('/')); // '/Test/' => '/Test' || '/' => '' |
|
| 365 | + $filePath = substr_replace($filePath, '', strrpos($filePath, '/'), strlen('/')); // '/Test/' => '/Test' || '/' => '' |
|
| 366 | 366 | |
| 367 | 367 | // replace the first slash |
| 368 | 368 | $pos = strpos($filePath, '/'); |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | private function checkSharedWithInitiator($fileInfo) { |
| 435 | 435 | try { |
| 436 | - $owner = str_replace('home::','',$fileInfo->getStoragename()); |
|
| 437 | - if ($this->userId === $owner){ |
|
| 436 | + $owner = str_replace('home::', '', $fileInfo->getStoragename()); |
|
| 437 | + if ($this->userId === $owner) { |
|
| 438 | 438 | // user is owner (no shared file) |
| 439 | 439 | return false; |
| 440 | 440 | } else { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | */ |
| 489 | 489 | private function removeFileExtension($status) { |
| 490 | 490 | try { |
| 491 | - return substr($status->getTarget(), 0, strrpos($status->getTarget(),'_OCR')); |
|
| 491 | + return substr($status->getTarget(), 0, strrpos($status->getTarget(), '_OCR')); |
|
| 492 | 492 | } catch (Exception $e) { |
| 493 | 493 | $this->handleException($e); |
| 494 | 494 | } |
@@ -91,24 +91,24 @@ |
||
| 91 | 91 | $this->setErrorDisplayed($errorDisplayed); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Specify data which should be serialized to JSON |
|
| 96 | - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
|
| 97 | - * @return mixed data which can be serialized by <b>json_encode</b>, |
|
| 98 | - * which is a value of any type other than a resource. |
|
| 99 | - * @since 5.4.0 |
|
| 100 | - */ |
|
| 101 | - function jsonSerialize() |
|
| 102 | - { |
|
| 103 | - return [ |
|
| 104 | - 'id' => $this->id, |
|
| 105 | - 'status' => $this->status, |
|
| 106 | - 'source' => $this->source, |
|
| 107 | - 'target' => $this->target, |
|
| 108 | - 'tempFile' => $this->tempFile, |
|
| 109 | - 'type' => $this->type, |
|
| 110 | - 'userId' => $this->userId, |
|
| 111 | - 'errorDisplayed' => $this->errorDisplayed |
|
| 112 | - ]; |
|
| 113 | - } |
|
| 94 | + /** |
|
| 95 | + * Specify data which should be serialized to JSON |
|
| 96 | + * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
|
| 97 | + * @return mixed data which can be serialized by <b>json_encode</b>, |
|
| 98 | + * which is a value of any type other than a resource. |
|
| 99 | + * @since 5.4.0 |
|
| 100 | + */ |
|
| 101 | + function jsonSerialize() |
|
| 102 | + { |
|
| 103 | + return [ |
|
| 104 | + 'id' => $this->id, |
|
| 105 | + 'status' => $this->status, |
|
| 106 | + 'source' => $this->source, |
|
| 107 | + 'target' => $this->target, |
|
| 108 | + 'tempFile' => $this->tempFile, |
|
| 109 | + 'type' => $this->type, |
|
| 110 | + 'userId' => $this->userId, |
|
| 111 | + 'errorDisplayed' => $this->errorDisplayed |
|
| 112 | + ]; |
|
| 113 | + } |
|
| 114 | 114 | } |
| 115 | 115 | \ No newline at end of file |