|
| 1 | +<?php |
| 2 | + |
| 3 | +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. |
| 4 | + |
| 5 | +namespace Algolia\AlgoliaSearch\Model\Composition; |
| 6 | + |
| 7 | +use Algolia\AlgoliaSearch\Model\AbstractModel; |
| 8 | +use Algolia\AlgoliaSearch\Model\ModelInterface; |
| 9 | + |
| 10 | +/** |
| 11 | + * Deduplication Class Doc Comment. |
| 12 | + * |
| 13 | + * @category Class |
| 14 | + * |
| 15 | + * @description Deduplication configures the methods used to resolve duplicate items between main search results and injected group results. |
| 16 | + */ |
| 17 | +class Deduplication extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable |
| 18 | +{ |
| 19 | + /** |
| 20 | + * Array of property to type mappings. Used for (de)serialization. |
| 21 | + * |
| 22 | + * @var string[] |
| 23 | + */ |
| 24 | + protected static $modelTypes = [ |
| 25 | + 'positioning' => '\Algolia\AlgoliaSearch\Model\Composition\DedupPositioning', |
| 26 | + ]; |
| 27 | + |
| 28 | + /** |
| 29 | + * Array of property to format mappings. Used for (de)serialization. |
| 30 | + * |
| 31 | + * @var string[] |
| 32 | + */ |
| 33 | + protected static $modelFormats = [ |
| 34 | + 'positioning' => null, |
| 35 | + ]; |
| 36 | + |
| 37 | + /** |
| 38 | + * Array of attributes where the key is the local name, |
| 39 | + * and the value is the original name. |
| 40 | + * |
| 41 | + * @var string[] |
| 42 | + */ |
| 43 | + protected static $attributeMap = [ |
| 44 | + 'positioning' => 'positioning', |
| 45 | + ]; |
| 46 | + |
| 47 | + /** |
| 48 | + * Array of attributes to setter functions (for deserialization of responses). |
| 49 | + * |
| 50 | + * @var string[] |
| 51 | + */ |
| 52 | + protected static $setters = [ |
| 53 | + 'positioning' => 'setPositioning', |
| 54 | + ]; |
| 55 | + |
| 56 | + /** |
| 57 | + * Array of attributes to getter functions (for serialization of requests). |
| 58 | + * |
| 59 | + * @var string[] |
| 60 | + */ |
| 61 | + protected static $getters = [ |
| 62 | + 'positioning' => 'getPositioning', |
| 63 | + ]; |
| 64 | + |
| 65 | + /** |
| 66 | + * Associative array for storing property values. |
| 67 | + * |
| 68 | + * @var mixed[] |
| 69 | + */ |
| 70 | + protected $container = []; |
| 71 | + |
| 72 | + /** |
| 73 | + * Constructor. |
| 74 | + * |
| 75 | + * @param mixed[] $data Associated array of property values |
| 76 | + */ |
| 77 | + public function __construct(?array $data = null) |
| 78 | + { |
| 79 | + if (isset($data['positioning'])) { |
| 80 | + $this->container['positioning'] = $data['positioning']; |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * Array of attributes where the key is the local name, |
| 86 | + * and the value is the original name. |
| 87 | + * |
| 88 | + * @return array |
| 89 | + */ |
| 90 | + public static function attributeMap() |
| 91 | + { |
| 92 | + return self::$attributeMap; |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * Array of property to type mappings. Used for (de)serialization. |
| 97 | + * |
| 98 | + * @return array |
| 99 | + */ |
| 100 | + public static function modelTypes() |
| 101 | + { |
| 102 | + return self::$modelTypes; |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * Array of property to format mappings. Used for (de)serialization. |
| 107 | + * |
| 108 | + * @return array |
| 109 | + */ |
| 110 | + public static function modelFormats() |
| 111 | + { |
| 112 | + return self::$modelFormats; |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Array of attributes to setter functions (for deserialization of responses). |
| 117 | + * |
| 118 | + * @return array |
| 119 | + */ |
| 120 | + public static function setters() |
| 121 | + { |
| 122 | + return self::$setters; |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Array of attributes to getter functions (for serialization of requests). |
| 127 | + * |
| 128 | + * @return array |
| 129 | + */ |
| 130 | + public static function getters() |
| 131 | + { |
| 132 | + return self::$getters; |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * Show all the invalid properties with reasons. |
| 137 | + * |
| 138 | + * @return array invalid properties with reasons |
| 139 | + */ |
| 140 | + public function listInvalidProperties() |
| 141 | + { |
| 142 | + $invalidProperties = []; |
| 143 | + |
| 144 | + if (!isset($this->container['positioning']) || null === $this->container['positioning']) { |
| 145 | + $invalidProperties[] = "'positioning' can't be null"; |
| 146 | + } |
| 147 | + |
| 148 | + return $invalidProperties; |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * Validate all the properties in the model |
| 153 | + * return true if all passed. |
| 154 | + * |
| 155 | + * @return bool True if all properties are valid |
| 156 | + */ |
| 157 | + public function valid() |
| 158 | + { |
| 159 | + return 0 === count($this->listInvalidProperties()); |
| 160 | + } |
| 161 | + |
| 162 | + /** |
| 163 | + * Gets positioning. |
| 164 | + * |
| 165 | + * @return DedupPositioning |
| 166 | + */ |
| 167 | + public function getPositioning() |
| 168 | + { |
| 169 | + return $this->container['positioning'] ?? null; |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * Sets positioning. |
| 174 | + * |
| 175 | + * @param DedupPositioning $positioning positioning |
| 176 | + * |
| 177 | + * @return self |
| 178 | + */ |
| 179 | + public function setPositioning($positioning) |
| 180 | + { |
| 181 | + $this->container['positioning'] = $positioning; |
| 182 | + |
| 183 | + return $this; |
| 184 | + } |
| 185 | + |
| 186 | + /** |
| 187 | + * Returns true if offset exists. False otherwise. |
| 188 | + * |
| 189 | + * @param int $offset Offset |
| 190 | + */ |
| 191 | + public function offsetExists($offset): bool |
| 192 | + { |
| 193 | + return isset($this->container[$offset]); |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * Gets offset. |
| 198 | + * |
| 199 | + * @param int $offset Offset |
| 200 | + * |
| 201 | + * @return null|mixed |
| 202 | + */ |
| 203 | + public function offsetGet($offset): mixed |
| 204 | + { |
| 205 | + return $this->container[$offset] ?? null; |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * Sets value based on offset. |
| 210 | + * |
| 211 | + * @param null|int $offset Offset |
| 212 | + * @param mixed $value Value to be set |
| 213 | + */ |
| 214 | + public function offsetSet($offset, $value): void |
| 215 | + { |
| 216 | + if (is_null($offset)) { |
| 217 | + $this->container[] = $value; |
| 218 | + } else { |
| 219 | + $this->container[$offset] = $value; |
| 220 | + } |
| 221 | + } |
| 222 | + |
| 223 | + /** |
| 224 | + * Unsets offset. |
| 225 | + * |
| 226 | + * @param int $offset Offset |
| 227 | + */ |
| 228 | + public function offsetUnset($offset): void |
| 229 | + { |
| 230 | + unset($this->container[$offset]); |
| 231 | + } |
| 232 | +} |
0 commit comments