ConfigController::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Nextcloud - Gallery
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 2017
11
 */
12
13
namespace OCA\Gallery\Controller;
14
15
use OCP\IRequest;
0 ignored issues
show
Bug introduced by
The type OCP\IRequest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use OCP\ILogger;
0 ignored issues
show
Bug introduced by
The type OCP\ILogger was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
use OCP\AppFramework\Controller;
0 ignored issues
show
Bug introduced by
The type OCP\AppFramework\Controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use OCP\AppFramework\Http;
0 ignored issues
show
Bug introduced by
The type OCP\AppFramework\Http was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
21
use OCA\Gallery\Service\ConfigService;
22
23
/**
24
 * Class ConfigController
25
 *
26
 * @package OCA\Gallery\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
	public function __construct(
42
		$appName,
43
		IRequest $request,
44
		ConfigService $configService,
45
		ILogger $logger
46
	) {
47
		parent::__construct($appName, $request);
48
49
		$this->configService = $configService;
50
		$this->logger = $logger;
51
	}
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
	public function get($extramediatypes = false) {
63
		try {
64
			return $this->getConfig($extramediatypes);
65
		} catch (\Exception $exception) {
66
			return $this->jsonError($exception, $this->request, $this->logger);
67
		}
68
	}
69
70
}
71