SpecialMapEditor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 49
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

3 Methods

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