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

PageController::votePoll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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