StatusController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 33
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getStatus() 0 5 1
1
<?php
2
3
/**
4
 * Nextcloud - OCR
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
namespace OCA\Ocr\Controller;
12
13
use OCP\AppFramework\Controller;
14
use OCA\Ocr\Service\StatusService;
15
use OCP\IRequest;
16
17
18
class StatusController extends Controller {
19
    use Errors;
20
    
21
    /**
22
     *
23
     * @var StatusService
24
     */
25
    private $service;
26
27
    /**
28
     * StatusController constructor.
29
     * 
30
     * @param string $AppName            
31
     * @param IRequest $request            
32
     * @param StatusService $service            
33
     */
34 3
    public function __construct($AppName, IRequest $request, StatusService $service) {
35 3
        parent::__construct($AppName, $request);
36 3
        $this->service = $service;
37 3
    }
38
39
    /**
40
     * Get the current status.
41
     * @NoAdminRequired
42
     * 
43
     * @return DataResponse
44
     */
45
    public function getStatus() {
46 2
        return $this->handleNotFound(function () {
47 2
            return $this->service->getStatus();
48 2
        });
49
    }
50
}
51