Passed
Push — testing ( 5c3fd5...931c5b )
by Stephan
04:12
created

SpecialBatchUpload::getGroupName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * File containing the SpecialBatchUpload class
4
 *
5
 * @copyright (C) 2016 - 2017, Stephan Gambke
6
 * @license   GNU General Public License, version 2 (or any later version)
7
 *
8
 * This software is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This software is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20
 *
21
 * @file
22
 * @ingroup SimpleBatchUpload
23
 */
24
25
namespace SimpleBatchUpload;
26
27
use SpecialPage;
0 ignored issues
show
Bug introduced by
The type SpecialPage 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...
28
29
/**
30
 * Class SpecialBatchUpload
31
 *
32
 * @package SimpleBatchUpload
33
 */
34
class SpecialBatchUpload extends SpecialPage {
35
36
	/**
37
	 * @param string $name Name of the special page, as seen in links and URLs
38
	 * @param string $restriction User right required, e.g. "block" or "delete"
39
	 * @param bool $listed Whether the page is listed in Special:Specialpages
40
	 */
41
	public function __construct( $name = '', $restriction = '', $listed = true ) {
42
		parent::__construct( 'BatchUpload', 'upload', $listed );
43
	}
44
45
	/**
46
	 * Under which header this special page is listed in Special:SpecialPages
47
	 * See messages 'specialpages-group-*' for valid names
48
	 * This method defaults to group 'other'
49
	 *
50
	 * @return string
51
	 */
52
	protected function getGroupName() {
53
		return 'media';
54
	}
55
56
	/**
57
	 * @param null|string $subpage
58
	 * @throws \MWException
59
	 */
60
	public function execute( $subpage ) {
61
62
		$this->setHeaders();
63
		$this->checkPermissions();
64
65
		$this->addPageContentToOutput( $subpage );
66
	}
67
68
	/**
69
	 * @param string|null $subpage
70
	 */
71
	private function addPageContentToOutput( $subpage ) {
72
		$renderer = new UploadButtonRenderer();
73
		$renderer->renderSpecialPage( $this, $subpage );
74
	}
75
76
}
77