25 public static $TRUEVALS = [
'true',
't',
'yes',
'y',
'on',
'1' ];
26 public static $FALSEVALS = [
'false',
'f',
'no',
'n',
'off',
'0' ];
28 public function validate( $name, $value, array $settings, array $options ) {
29 $value = strtolower( $value );
30 if ( in_array( $value, self::$TRUEVALS,
true ) ) {
33 if ( $value ===
'' || in_array( $value, self::$FALSEVALS,
true ) ) {
39 ->textListParams( array_map( [ $this,
'quoteVal' ], self::$TRUEVALS ) )
40 ->numParams( count( self::$TRUEVALS ) )
41 ->textListParams( array_merge(
42 array_map( [ $this,
'quoteVal' ], self::$FALSEVALS ),
43 [ MessageValue::new(
'paramvalidator-emptystring' ) ]
45 ->numParams( count( self::$FALSEVALS ) + 1 ),
46 $name, $value, $settings, $options
50 private function quoteVal( $v ) {
54 public function stringifyValue( $name, $value, array $settings, array $options ) {
55 return $value ? self::$TRUEVALS[0] : self::$FALSEVALS[0];
58 public function getHelpInfo( $name, array $settings, array $options ) {
59 $info = parent::getHelpInfo( $name, $settings, $options );