Passed
Push — master ( fce6df...8e01ff )
by Georg
14:04 queued 11s
created

PredefinedStatusController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A findAll() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright Copyright (c) 2020, Georg Ehrke
7
 *
8
 * @author Georg Ehrke <[email protected]>
9
 *
10
 * @license AGPL-3.0
11
 *
12
 * This code is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License, version 3,
14
 * as published by the Free Software Foundation.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License, version 3,
22
 * along with this program. If not, see <http://www.gnu.org/licenses/>
23
 *
24
 */
25
26
namespace OCA\UserStatus\Controller;
27
28
use OCA\UserStatus\Service\PredefinedStatusService;
29
use OCP\AppFramework\Http\DataResponse;
30
use OCP\AppFramework\OCSController;
31
use OCP\IRequest;
32
33
/**
34
 * Class DefaultStatusController
35
 *
36
 * @package OCA\UserStatus\Controller
37
 */
38
class PredefinedStatusController extends OCSController {
39
40
	/** @var PredefinedStatusService */
41
	private $predefinedStatusService;
42
43
	/**
44
	 * AStatusController constructor.
45
	 *
46
	 * @param string $appName
47
	 * @param IRequest $request
48
	 * @param PredefinedStatusService $predefinedStatusService
49
	 */
50
	public function __construct(string $appName,
51
								IRequest $request,
52
								PredefinedStatusService $predefinedStatusService) {
53
		parent::__construct($appName, $request);
54
		$this->predefinedStatusService = $predefinedStatusService;
55
	}
56
57
	/**
58
	 * @NoAdminRequired
59
	 *
60
	 * @return DataResponse
61
	 */
62
	public function findAll():DataResponse {
63
		return new DataResponse($this->predefinedStatusService->getDefaultStatuses());
64
	}
65
}
66