PluginProbe
WooCommerce / 11.0.0
WooCommerce v11.0.0
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / packages / email-editor / src / Validator / Schema / class-integer-schema.php
class-integer-schema.php
76 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This file is part of the WooCommerce Email Editor package
4 *
5 * @package Automattic\WooCommerce\EmailEditor
6 */
7
8 declare( strict_types = 1 );
9 namespace Automattic\WooCommerce\EmailEditor\Validator\Schema;
10
11 use Automattic\WooCommerce\EmailEditor\Validator\Schema;
12
13 /**
14 * Represents a schema for an integer.
15 * See: https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#numbers
16 */
17 class Integer_Schema extends Schema {
18 /**
19 * Schema definition.
20 *
21 * @var array
22 */
23 protected $schema = array(
24 'type' => 'integer',
25 );
26
27 /**
28 * Sets the minimum value of the integer.
29 *
30 * @param int $value Minimum value of the integer.
31 */
32 public function minimum( int $value ): self {
33 return $this->update_schema_property( 'minimum', $value )
34 ->unset_schema_property( 'exclusiveMinimum' );
35 }
36
37 /**
38 * Sets the exclusiveMinimum property to true.
39 *
40 * @param int $value Minimum value of the integer.
41 */
42 public function exclusiveMinimum( int $value ): self {
43 return $this->update_schema_property( 'minimum', $value )
44 ->update_schema_property( 'exclusiveMinimum', true );
45 }
46
47 /**
48 * Sets the maximum value of the integer.
49 *
50 * @param int $value Maximum value of the integer.
51 */
52 public function maximum( int $value ): self {
53 return $this->update_schema_property( 'maximum', $value )
54 ->unset_schema_property( 'exclusiveMaximum' );
55 }
56
57 /**
58 * Sets the exclusiveMaximum property to true.
59 *
60 * @param int $value Maximum value of the integer.
61 */
62 public function exclusiveMaximum( int $value ): self {
63 return $this->update_schema_property( 'maximum', $value )
64 ->update_schema_property( 'exclusiveMaximum', true );
65 }
66
67 /**
68 * Sets the multipleOf property.
69 *
70 * @param int $value Multiple of the integer.
71 */
72 public function multipleOf( int $value ): self {
73 return $this->update_schema_property( 'multipleOf', $value );
74 }
75 }
76