MediaWiki  1.34.0
PresenceBooleanDef.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
19 class PresenceBooleanDef extends TypeDef {
20 
21  public function getValue( $name, array $settings, array $options ) {
22  return $this->callbacks->hasParam( $name, $options );
23  }
24 
25  public function validate( $name, $value, array $settings, array $options ) {
26  return (bool)$value;
27  }
28 
29  public function describeSettings( $name, array $settings, array $options ) {
30  $info = parent::describeSettings( $name, $settings, $options );
31  unset( $info['default'] );
32  return $info;
33  }
34 
35 }
Wikimedia\ParamValidator\TypeDef
Base definition for ParamValidator types.
Definition: TypeDef.php:15
Wikimedia\ParamValidator\TypeDef\PresenceBooleanDef\validate
validate( $name, $value, array $settings, array $options)
Validate the value.
Definition: PresenceBooleanDef.php:25
Wikimedia\ParamValidator\TypeDef\PresenceBooleanDef
Type definition for checkbox-like boolean types.
Definition: PresenceBooleanDef.php:19
Wikimedia\ParamValidator\TypeDef\PresenceBooleanDef\describeSettings
describeSettings( $name, array $settings, array $options)
"Describe" a settings array
Definition: PresenceBooleanDef.php:29
Wikimedia\ParamValidator\TypeDef
Definition: BooleanDef.php:3
Wikimedia\ParamValidator\TypeDef\PresenceBooleanDef\getValue
getValue( $name, array $settings, array $options)
Get the value from the request.
Definition: PresenceBooleanDef.php:21