Completed
Pull Request — master (#43)
by Janis
03:35
created
lib/Db/OcrStatus.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,13 +73,13 @@
 block discarded – undo
73 73
 	/**
74 74
 	 * OcrStatus constructor.
75 75
 	 *
76
-	 * @param null $status
77
-	 * @param null $source
78
-	 * @param null $target
76
+	 * @param string $status
77
+	 * @param string $source
78
+	 * @param string $target
79 79
 	 * @param null $tempFile
80
-	 * @param null $type
80
+	 * @param string $type
81 81
 	 * @param null $userId
82
-	 * @param null $errorDisplayed
82
+	 * @param boolean $errorDisplayed
83 83
 	 */
84 84
 	public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null) {
85 85
 		$this->setStatus($status);
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -91,24 +91,24 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
lib/Service/OcrService.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,6 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * The PersonalSettingsController will have the opportunity to delete ocr status objects.
253 253
 	 *
254 254
 	 * @param $statusId
255
+	 * @param string $userId
255 256
 	 * @return OcrStatus
256 257
 	 */
257 258
 	public function deleteStatus($statusId, $userId) {
@@ -281,7 +282,7 @@  discard block
 block discarded – undo
281 282
 	/**
282 283
 	 * Gets all status objects for a specific user in order to list them on the personal settings page.
283 284
 	 *
284
-	 * @param $userId
285
+	 * @param string $userId
285 286
 	 * @return array
286 287
 	 */
287 288
 	public function getAllForPersonal($userId) {
@@ -429,7 +430,7 @@  discard block
 block discarded – undo
429 430
 
430 431
 	/**
431 432
 	 * @param File $fileInfo
432
-	 * @return bool
433
+	 * @return boolean|null
433 434
 	 */
434 435
 	private function checkSharedWithInitiator($fileInfo) {
435 436
 		try {
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.