Completed
Push — stable9 ( ab68a4...eef0b3 )
by Olivier
10s
created

ConfigController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 43
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A get() 0 7 2
1
<?php
2
/**
3
 * ownCloud - galleryplus
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Olivier Paroz <[email protected]>
9
 *
10
 * @copyright Olivier Paroz 2016
11
 */
12
13
namespace OCA\GalleryPlus\Controller;
14
15
use OCP\IRequest;
16
use OCP\ILogger;
17
18
use OCP\AppFramework\Controller;
19
use OCP\AppFramework\Http;
20
21
use OCA\GalleryPlus\Service\ConfigService;
22
23
/**
24
 * Class ConfigController
25
 *
26
 * @package OCA\GalleryPlus\Controller
27
 */
28
class ConfigController extends Controller {
29
30
	use Config;
31
	use HttpError;
32
33
	/**
34
	 * Constructor
35
	 *
36
	 * @param string $appName
37
	 * @param IRequest $request
38
	 * @param ConfigService $configService
39
	 * @param ILogger $logger
40
	 */
41 27
	public function __construct(
42
		$appName,
43
		IRequest $request,
44
		ConfigService $configService,
45
		ILogger $logger
46
	) {
47 27
		parent::__construct($appName, $request);
48
49 27
		$this->configService = $configService;
50 27
		$this->logger = $logger;
51 27
	}
52
53
	/**
54
	 * @NoAdminRequired
55
	 *
56
	 * Returns an app configuration array
57
	 *
58
	 * @param bool $extramediatypes
59
	 *
60
	 * @return array <string,null|array>
61
	 */
62 17
	public function get($extramediatypes = false) {
63
		try {
64 17
			return $this->getConfig($extramediatypes);
65 2
		} catch (\Exception $exception) {
66 2
			return $this->jsonError($exception);
67
		}
68
	}
69
70
}
71