Completed
Pull Request — stable9 (#52)
by Olivier
09:56
created

ConfigController::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 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