Completed
Push — mv ( 2424da )
by Jeroen De
04:08
created

SpecialMapEditor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 52
ccs 0
cts 26
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A execute() 0 17 1
A getAttribs() 0 6 1
A getGroupName() 0 3 1
1
<?php
2
3
namespace Maps\MediaWiki\Specials;
4
5
use MapEditorHtml;
6
use MapsGoogleMaps3;
7
use SpecialPage;
8
9
/**
10
 * Special page with map editor interface using Google Maps.
11
 *
12
 * @since 2.0
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Kim Eik
16
 * @author Jeroen De Dauw < [email protected] >
17
 */
18
class SpecialMapEditor extends SpecialPage {
19
20
	/**
21
	 * @see SpecialPage::__construct
22
	 *
23
	 * @since 2.0
24
	 */
25
	public function __construct() {
26
		parent::__construct( 'MapEditor' );
27
	}
28
29
	/**
30
	 * @see SpecialPage::execute
31
	 *
32
	 * @since 2.0
33
	 *
34
	 * @param null|string $subPage
35
	 */
36
	public function execute( $subPage ) {
37
		$this->setHeaders();
38
39
		$outputPage = $this->getOutput();
40
41
		$outputPage->addHtml(
42
			MapsGoogleMaps3::getApiScript(
43
				$this->getLanguage()->getCode(),
44
				[ 'libraries' => 'drawing' ]
45
			)
46
		);
47
48
		$outputPage->addModules( 'mapeditor' );
49
		$editorHtml = new MapEditorHtml( $this->getAttribs() );
50
		$html = $editorHtml->getEditorHtml();
51
		$outputPage->addHTML( $html );
52
	}
53
54
	/**
55
	 * @since 2.1
56
	 *
57
	 * @return array
58
	 */
59
	protected function getAttribs() {
60
		return [
61
			'id' => 'map-canvas',
62
			'context' => 'Maps\MediaWiki\Specials\SpecialMapEditor'
63
		];
64
	}
65
66
	protected function getGroupName() {
67
		return 'Maps';
68
	}
69
}
70