Completed
Push — address-as-title ( 9b6eeb...601934 )
by Peter
11:07
created

CriterionIsNonNumeric::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Parameter criterion stating that the value must be a non numeric one
5
 *
6
 * @since 3.0
7
 *
8
 * @file CriterionIsNonNumeric.php
9
 * @ingroup Maps
10
 * @ingroup Criteria
11
 *
12
 * @author Daniel Werner
13
 */
14
class CriterionIsNonNumeric extends ItemParameterCriterion {
15
16
	/**
17
	 * Constructor
18
	 *
19
	 * @since 3.0
20
	 */
21
	public function __construct() {
22
		parent::__construct();
23
	}
24
25
	/**
26
	 * @see ItemParameterCriterion::validate
27
	 */
28
	protected function doValidation( $value, Parameter $parameter, array $parameters ) {
29
		return !is_numeric( $value );
30
	}
31
32
	/**
33
	 * @see ItemParameterCriterion::getItemErrorMessage
34
	 */
35
	protected function getItemErrorMessage( Parameter $parameter ) {
36
		return wfMessage( 'validation-error-no-non-numeric', $parameter->getOriginalName() )->parse();
37
	}
38
39
	/**
40
	 * @see ItemParameterCriterion::getFullListErrorMessage
41
	 */
42
	protected function getFullListErrorMessage( Parameter $parameter ) {
43
		global $wgLang;
44
		return wfMessage( 'validation-error-no-non-numerics', $parameter->getOriginalName() )->parse();
45
	}
46
}
47