Completed
Branch master (541b2e)
by
unknown
26:09
created

SearchInputWidget::getJavaScriptClassName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 3
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * MediaWiki Widgets – SearchInputWidget class.
4
 *
5
 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
6
 * @license The MIT License (MIT); see LICENSE.txt
7
 */
8
namespace MediaWiki\Widget;
9
10
/**
11
 * Search input widget.
12
 */
13
class SearchInputWidget extends TitleInputWidget {
14
15
	protected $pushPending = false;
16
	protected $validateTitle = false;
17
	protected $highlightFirst = false;
18
19
	/**
20
	 * @param array $config Configuration options
21
	 * @param int|null $config['pushPending'] Whether the input should be visually marked as
0 ignored issues
show
Documentation introduced by
There is no parameter named $config['pushPending']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
22
	 *  "pending", while requesting suggestions (default: true)
23
	 */
24
	public function __construct( array $config = [] ) {
25
		// Parent constructor
26
		parent::__construct(
27
			array_merge( [
28
				'infusable' => true,
29
				'maxLength' => null,
30
				'type' => 'search',
31
				'icon' => 'search'
32
			], $config )
33
		);
34
35
		// Properties, which are ignored in PHP and just shipped back to JS
36
		if ( isset( $config['pushPending'] ) ) {
37
			$this->pushPending = $config['pushPending'];
38
		}
39
40
		// Initialization
41
		$this->addClasses( [ 'mw-widget-searchInputWidget' ] );
42
	}
43
44
	protected function getJavaScriptClassName() {
45
		return 'mw.widgets.SearchInputWidget';
46
	}
47
48
	public function getConfig( &$config ) {
49
		$config['pushPending'] = $this->pushPending;
50
		return parent::getConfig( $config );
51
	}
52
}
53