3 namespace Wikimedia\ParamValidator\TypeDef
;
5 use Wikimedia\ParamValidator\TypeDef
;
8 * Type definition for checkbox-like boolean types
10 * This boolean is considered true if the parameter is present in the request,
11 * regardless of value. The only way for it to be false is for the parameter to
12 * be omitted entirely.
14 * The result from validate() is a PHP boolean.
18 class PresenceBooleanDef
extends TypeDef
{
20 public function getValue( $name, array $settings, array $options ) {
21 return $this->callbacks
->hasParam( $name, $options );
24 public function validate( $name, $value, array $settings, array $options ) {
28 public function describeSettings( $name, array $settings, array $options ) {
29 $info = parent
::describeSettings( $name, $settings, $options );
30 unset( $info['default'] );