Completed
Push — master ( 1ac2ea...0da6ae )
by René
16s queued 12s
created

PageController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 43.75%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 13
dl 0
loc 56
ccs 7
cts 16
cp 0.4375
rs 10
c 2
b 1
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A votePublic() 0 3 1
A index() 0 3 1
A polls() 0 3 1
A list() 0 3 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]>
4
 *
5
 * @author Vinzenz Rosenkranz <[email protected]>
6
 * @author René Gieling <[email protected]>
7
 *
8
 * @license GNU AGPL version 3 or any later version
9
 *
10
 *  This program is free software: you can redistribute it and/or modify
11
 *  it under the terms of the GNU Affero General Public License as
12
 *  published by the Free Software Foundation, either version 3 of the
13
 *  License, or (at your option) any later version.
14
 *
15
 *  This program is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU Affero General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU Affero General Public License
21
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 *
23
 */
24
25
namespace OCA\Polls\Controller;
26
27
use OCP\IRequest;
28
29
use OCP\AppFramework\Controller;
30
use OCP\AppFramework\Db\DoesNotExistException;
31
use OCP\AppFramework\Http\ContentSecurityPolicy;
32
use OCP\AppFramework\Http\JSONResponse;
33
use OCP\AppFramework\Http\RedirectResponse;
34
use OCP\AppFramework\Http\TemplateResponse;
35
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
36
use OCP\IURLGenerator;
37
38
class PageController extends Controller {
39
40
	private $urlGenerator;
41
42
	/**
43
	 * PageController constructor.
44
	 * @param string $appName
45
	 * @param IRequest $request
46
	 * @param IURLGenerator $urlGenerator
47
	 */
48 1
	public function __construct(
49
		$appName,
50
		IRequest $request,
51
		IURLGenerator $urlGenerator
52
	) {
53 1
		parent::__construct($appName, $request);
54 1
		$this->urlGenerator = $urlGenerator;
55 1
	}
56
57
	/**
58
	 * @NoAdminRequired
59
	 * @NoCSRFRequired
60
	 */
61 1
	public function index() {
62 1
		return new TemplateResponse('polls', 'polls.tmpl',
63 1
		['urlGenerator' => $this->urlGenerator]);
64
	}
65
66
	/**
67
	 * @NoAdminRequired
68
	 * @NoCSRFRequired
69
	 */
70
	public function polls() {
71
		return new TemplateResponse('polls', 'polls.tmpl',
72
		['urlGenerator' => $this->urlGenerator]);
73
	}
74
75
	/**
76
	 * @NoAdminRequired
77
	 * @NoCSRFRequired
78
	 */
79
	public function list() {
80
		return new TemplateResponse('polls', 'polls.tmpl',
81
		['urlGenerator' => $this->urlGenerator]);
82
	}
83
84
	/**
85
	 * @PublicPage
86
	 * @NoAdminRequired
87
	 * @NoCSRFRequired
88
	 * @param string $token
89
	 * @return PublicTemplateResponse
90
	 */
91
	public function votePublic($token) {
0 ignored issues
show
Unused Code introduced by
The parameter $token is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

91
	public function votePublic(/** @scrutinizer ignore-unused */ $token) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
92
		return new PublicTemplateResponse('polls', 'polls.tmpl', [
93
			'urlGenerator' => $this->urlGenerator]);
94
	}
95
96
97
}
98