Automattic\WooCommerce\EmailEditor\Validator\Schema
Number_Schema{}└─ Schema
Represents a schema for a number. See: https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#numbers
No Hooks.
Usage
$Number_Schema = new Number_Schema(); // use class methods
Methods
- public exclusiveMaximum( float $value )
- public exclusiveMinimum( float $value )
- public maximum( float $value )
- public minimum( float $value )
- public multipleOf( float $value )
Number_Schema{} Number Schema{} code WC 10.4.3
class Number_Schema extends Schema {
/**
* Schema definition.
*
* @var array
*/
protected $schema = array(
'type' => 'number',
);
/**
* Sets the minimum value of the number.
*
* @param float $value Minimum value of the number.
*/
public function minimum( float $value ): self {
return $this->update_schema_property( 'minimum', $value )
->unset_schema_property( 'exclusiveMinimum' );
}
/**
* Sets the exclusiveMinimum property to true.
*
* @param float $value Minimum value of the number.
*/
public function exclusiveMinimum( float $value ): self {
return $this->update_schema_property( 'minimum', $value )
->update_schema_property( 'exclusiveMinimum', true );
}
/**
* Sets the maximum value of the number.
*
* @param float $value Maximum value of the number.
*/
public function maximum( float $value ): self {
return $this->update_schema_property( 'maximum', $value )
->unset_schema_property( 'exclusiveMaximum' );
}
/**
* Sets the exclusiveMaximum property to true.
*
* @param float $value Maximum value of the number.
*/
public function exclusiveMaximum( float $value ): self {
return $this->update_schema_property( 'maximum', $value )
->update_schema_property( 'exclusiveMaximum', true );
}
/**
* Sets the multipleOf property.
*
* @param float $value Multiple of the number.
*/
public function multipleOf( float $value ): self {
return $this->update_schema_property( 'multipleOf', $value );
}
}