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