MailPoet\EmailEditor\Validator\Schema
Array_Schema{}
Represents a schema for an array. See: https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#arrays
No Hooks.
Usage
$Array_Schema = new Array_Schema(); // use class methods
Methods
- public items( Schema $schema )
- public maxItems( int $value )
- public minItems( int $value )
- public uniqueItems()
Array_Schema{} Array Schema{} code WC 9.8.1
class Array_Schema extends Schema { /** * Schema definition. * * @var array */ protected $schema = array( 'type' => 'array', ); /** * Sets the schema for the items in the array. * * @param Schema $schema Schema for the items in the array. */ public function items( Schema $schema ): self { return $this->update_schema_property( 'items', $schema->to_array() ); } /** * Sets the minimum number of items in the array. * * @param int $value Minimum number of items in the array. */ public function minItems( int $value ): self { return $this->update_schema_property( 'minItems', $value ); } /** * Sets the maximum number of items in the array. * * @param int $value Maximum number of items in the array. */ public function maxItems( int $value ): self { return $this->update_schema_property( 'maxItems', $value ); } /** * Sets the uniqueItems property to true. */ public function uniqueItems(): self { return $this->update_schema_property( 'uniqueItems', true ); } }