@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $container = $this->getContainer(); |
| 39 | 39 | $server = $container->getServer(); |
| 40 | 40 | |
| 41 | - $container->registerService('PaperHiveController', function (IAppContainer $c) use ($server) { |
|
| 41 | + $container->registerService('PaperHiveController', function(IAppContainer $c) use ($server) { |
|
| 42 | 42 | $user = $server->getUserSession()->getUser(); |
| 43 | 43 | if ($user) { |
| 44 | 44 | $uid = $user->getUID(); |
@@ -150,6 +150,10 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $dir |
|
| 155 | + * @param string $filename |
|
| 156 | + */ |
|
| 153 | 157 | private function getBookIdforPath($dir, $filename){ |
| 154 | 158 | if (!empty($filename)) { |
| 155 | 159 | $path = $dir . '/' . $filename; |
@@ -186,7 +190,7 @@ discard block |
||
| 186 | 190 | * @NoAdminRequired |
| 187 | 191 | * |
| 188 | 192 | * @param string $bookID |
| 189 | - * @return string/boolean |
|
| 193 | + * @return string |
|
| 190 | 194 | */ |
| 191 | 195 | private function fetchDocument($bookID) { |
| 192 | 196 | $urlDocument = $this->paperhive_base_url . $this->paperhive_api_documents . $bookID; |
@@ -287,7 +291,6 @@ discard block |
||
| 287 | 291 | * |
| 288 | 292 | * @NoAdminRequired |
| 289 | 293 | * |
| 290 | - * @param string $bookID |
|
| 291 | 294 | * @return DataResponse |
| 292 | 295 | */ |
| 293 | 296 | public function getPaperHiveDetails() { |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - private function getBookIdforPath($dir, $filename){ |
|
| 153 | + private function getBookIdforPath($dir, $filename) { |
|
| 154 | 154 | if (!empty($filename)) { |
| 155 | 155 | $path = $dir . '/' . $filename; |
| 156 | 156 | |
| 157 | 157 | $fileInfo = $this->view->getFileInfo($path); |
| 158 | - if($fileInfo && $bookId = $this->paperHiveMetadata->getBookID($fileInfo['fileid'])) { |
|
| 158 | + if ($fileInfo && $bookId = $this->paperHiveMetadata->getBookID($fileInfo['fileid'])) { |
|
| 159 | 159 | return $bookId; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | // Save the file |
| 244 | 244 | $title = $paperHiveObject['metadata']['title']; |
| 245 | 245 | $filename = $title . $this->paperhive_file_extension; |
| 246 | - if($dir == '/') { |
|
| 246 | + if ($dir == '/') { |
|
| 247 | 247 | $path = $dir . $filename; |
| 248 | 248 | } else { |
| 249 | 249 | $path = $dir . '/' . $filename; |
@@ -251,26 +251,26 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $exists = $this->view->file_exists($path); |
| 253 | 253 | if ($exists) { |
| 254 | - $message = (string) $this->l->t('The file already exists.'); |
|
| 254 | + $message = (string)$this->l->t('The file already exists.'); |
|
| 255 | 255 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | try { |
| 259 | 259 | $created = $this->view->touch($path); |
| 260 | - if(!$created) { |
|
| 261 | - $message = (string) $this->l->t('Could not save document.'); |
|
| 260 | + if (!$created) { |
|
| 261 | + $message = (string)$this->l->t('Could not save document.'); |
|
| 262 | 262 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $fileInfo = $this->view->getFileInfo($path); |
| 266 | 266 | $inserted = $this->paperHiveMetadata->insertBookID($fileInfo['fileid'], $bookID); |
| 267 | - if(!$inserted) { |
|
| 267 | + if (!$inserted) { |
|
| 268 | 268 | $this->view->unlink($path); |
| 269 | - $message = (string) $this->l->t('Could not save document metadata.'); |
|
| 269 | + $message = (string)$this->l->t('Could not save document metadata.'); |
|
| 270 | 270 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
| 271 | 271 | } |
| 272 | 272 | } catch (LockedException $e) { |
| 273 | - $message = (string) $this->l->t('The file is locked.'); |
|
| 273 | + $message = (string)$this->l->t('The file is locked.'); |
|
| 274 | 274 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
| 275 | 275 | } catch (ForbiddenException $e) { |
| 276 | 276 | return new DataResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @param $fileId |
| 33 | - * @param $docId |
|
| 33 | + * @param string $docId |
|
| 34 | 34 | * @return bool |
| 35 | 35 | * @throws \OC\DatabaseException |
| 36 | 36 | */ |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public static function delete_metadata_hook($params) { |
| 64 | 64 | $path = $params[\OC\Files\Filesystem::signal_param_path]; |
| 65 | - if ($path<>'') { |
|
| 65 | + if ($path <> '') { |
|
| 66 | 66 | $hook = self::createForStaticLegacyCode(); |
| 67 | 67 | $hook->deleteBookMetadata($path); |
| 68 | 68 | } |