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