Completed
Pull Request — master (#93)
by Janis
13:30
created

StatusController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 33
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getStatus() 0 5 1
1
<?php
2
/**
3
 * Nextcloud - OCR
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Janis Koehr <[email protected]>
9
 * @copyright Janis Koehr 2017
10
 */
11
12
namespace OCA\Ocr\Controller;
13
14
use OCP\AppFramework\Controller;
15
use OCA\Ocr\Service\StatusService;
16
use OCP\IRequest;
17
18
class StatusController extends Controller {
19
	
20
	/**
21
	 * @var OcrService
22
	 */
23
	private $service;
24
	
25
	use Errors;
26
	
27
	/**
28
	 * StatusController constructor.
29
	 *
30
	 * @param string $AppName
31
	 * @param IRequest $request
32
	 * @param StatusService $service
33
	 */
34
	public function __construct($AppName, IRequest $request, StatusService $service) {
35
		parent::__construct($AppName, $request);
36
		$this->service = $service;
0 ignored issues
show
Documentation Bug introduced by
It seems like $service of type object<OCA\Ocr\Service\StatusService> is incompatible with the declared type object<OCA\Ocr\Controller\OcrService> of property $service.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
37
	}
38
	
39
	/**
40
	 * Get the current status.
41
	 * @NoAdminRequired
42
	 * @return DataResponse
43
	 */
44
	public function getStatus() {
45
		return $this->handleNotFound(function() {
46
			return $this->service->getStatus();
47
		});
48
	}
49
	
50
}
51