class-any-of-schema.php
11 months ago
class-array-schema.php
11 months ago
class-boolean-schema.php
11 months ago
class-integer-schema.php
11 months ago
class-null-schema.php
11 months ago
class-number-schema.php
11 months ago
class-object-schema.php
11 months ago
class-one-of-schema.php
11 months ago
class-string-schema.php
11 months ago
index.php
11 months ago
class-array-schema.php
23 lines
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | namespace Automattic\WooCommerce\EmailEditor\Validator\Schema; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use Automattic\WooCommerce\EmailEditor\Validator\Schema; |
| 6 | class Array_Schema extends Schema { |
| 7 | protected $schema = array( |
| 8 | 'type' => 'array', |
| 9 | ); |
| 10 | public function items( Schema $schema ): self { |
| 11 | return $this->update_schema_property( 'items', $schema->to_array() ); |
| 12 | } |
| 13 | public function minItems( int $value ): self { |
| 14 | return $this->update_schema_property( 'minItems', $value ); |
| 15 | } |
| 16 | public function maxItems( int $value ): self { |
| 17 | return $this->update_schema_property( 'maxItems', $value ); |
| 18 | } |
| 19 | public function uniqueItems(): self { |
| 20 | return $this->update_schema_property( 'uniqueItems', true ); |
| 21 | } |
| 22 | } |
| 23 |