Completed
Pull Request — master (#11)
by Joas
20:39
created

AdminController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 9
ccs 8
cts 8
cp 1
rs 9.6666
cc 1
eloc 8
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016 Morris Jobke <[email protected]>
4
 *
5
 * @license GNU AGPL version 3 or any later version
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License as
9
 * published by the Free Software Foundation, either version 3 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 */
21
22
namespace OCA\FilesAccessControl\Controller;
23
24
use OCP\AppFramework\Controller;
25
use OCP\AppFramework\Http\TemplateResponse;
26
use OCP\IL10N;
27
use OCP\IRequest;
28
use Symfony\Component\EventDispatcher\EventDispatcher;
29
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
30
31
class AdminController extends Controller {
32
33
	/** @var EventDispatcher */
34
	protected $eventDispatcher;
35
	/** @var IL10N */
36
	protected $l10n;
37
38
	/**
39
	 * @param string $appName
40
	 * @param IRequest $request
41
	 * @param EventDispatcherInterface $eventDispatcher
42
	 * @param IL10N $l10n
43
	 */
44 1
	public function __construct($appName,
45
								IRequest $request,
46
								EventDispatcherInterface $eventDispatcher,
47
								IL10N $l10n) {
48 1
		parent::__construct($appName, $request);
49
50 1
		$this->eventDispatcher = $eventDispatcher;
0 ignored issues
show
Documentation Bug introduced by
It seems like $eventDispatcher of type object<Symfony\Component...entDispatcherInterface> is incompatible with the declared type object<Symfony\Component...atcher\EventDispatcher> of property $eventDispatcher.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
51 1
		$this->l10n = $l10n;
52 1
	}
53
54
	/**
55
	 * @return TemplateResponse
56
	 */
57 1
	public function index() {
58 1
		$this->eventDispatcher->dispatch('OCP\WorkflowEngine::loadAdditionalSettingScripts');
59 1
		\OCP\Util::addScript($this->appName, 'admin');
60 1
		return new TemplateResponse('workflowengine', 'admin', [
61 1
			'appid' => $this->appName,
62 1
			'heading' => $this->l10n->t('File access control'),
63 1
			'description' => $this->l10n->t('Each rule group consists of one or more rules. A request matches a group if all rules evaluate to true. If a request matches at least one of the defined groups, the request is blocked and the file content can not be read or written.'),
64 1
		], 'blank');
65
	}
66
}
67