MeasurementUnit.php
| 1 | <?php |
| 2 | /** |
| 3 | * NOTE: This class is auto generated by the swagger code generator program. |
| 4 | * https://github.com/swagger-api/swagger-codegen |
| 5 | * Do not edit the class manually. |
| 6 | */ |
| 7 | |
| 8 | namespace SquareConnect\Model; |
| 9 | |
| 10 | use \ArrayAccess; |
| 11 | /** |
| 12 | * MeasurementUnit Class Doc Comment |
| 13 | * |
| 14 | * @category Class |
| 15 | * @package SquareConnect |
| 16 | * @author Square Inc. |
| 17 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 |
| 18 | * @link https://squareup.com/developers |
| 19 | */ |
| 20 | class MeasurementUnit implements ArrayAccess |
| 21 | { |
| 22 | /** |
| 23 | * Array of property to type mappings. Used for (de)serialization |
| 24 | * @var string[] |
| 25 | */ |
| 26 | static $swaggerTypes = array( |
| 27 | 'custom_unit' => '\SquareConnect\Model\MeasurementUnitCustom', |
| 28 | 'area_unit' => 'string', |
| 29 | 'length_unit' => 'string', |
| 30 | 'volume_unit' => 'string', |
| 31 | 'weight_unit' => 'string', |
| 32 | 'generic_unit' => 'string', |
| 33 | 'type' => 'string' |
| 34 | ); |
| 35 | |
| 36 | /** |
| 37 | * Array of attributes where the key is the local name, and the value is the original name |
| 38 | * @var string[] |
| 39 | */ |
| 40 | static $attributeMap = array( |
| 41 | 'custom_unit' => 'custom_unit', |
| 42 | 'area_unit' => 'area_unit', |
| 43 | 'length_unit' => 'length_unit', |
| 44 | 'volume_unit' => 'volume_unit', |
| 45 | 'weight_unit' => 'weight_unit', |
| 46 | 'generic_unit' => 'generic_unit', |
| 47 | 'type' => 'type' |
| 48 | ); |
| 49 | |
| 50 | /** |
| 51 | * Array of attributes to setter functions (for deserialization of responses) |
| 52 | * @var string[] |
| 53 | */ |
| 54 | static $setters = array( |
| 55 | 'custom_unit' => 'setCustomUnit', |
| 56 | 'area_unit' => 'setAreaUnit', |
| 57 | 'length_unit' => 'setLengthUnit', |
| 58 | 'volume_unit' => 'setVolumeUnit', |
| 59 | 'weight_unit' => 'setWeightUnit', |
| 60 | 'generic_unit' => 'setGenericUnit', |
| 61 | 'type' => 'setType' |
| 62 | ); |
| 63 | |
| 64 | /** |
| 65 | * Array of attributes to getter functions (for serialization of requests) |
| 66 | * @var string[] |
| 67 | */ |
| 68 | static $getters = array( |
| 69 | 'custom_unit' => 'getCustomUnit', |
| 70 | 'area_unit' => 'getAreaUnit', |
| 71 | 'length_unit' => 'getLengthUnit', |
| 72 | 'volume_unit' => 'getVolumeUnit', |
| 73 | 'weight_unit' => 'getWeightUnit', |
| 74 | 'generic_unit' => 'getGenericUnit', |
| 75 | 'type' => 'getType' |
| 76 | ); |
| 77 | |
| 78 | /** |
| 79 | * $custom_unit A custom unit of measurement defined by the seller using the Point of Sale app or ad-hoc as an order line item. |
| 80 | * @var \SquareConnect\Model\MeasurementUnitCustom |
| 81 | */ |
| 82 | protected $custom_unit; |
| 83 | /** |
| 84 | * $area_unit Represents a standard area unit. See [MeasurementUnitArea](#type-measurementunitarea) for possible values |
| 85 | * @var string |
| 86 | */ |
| 87 | protected $area_unit; |
| 88 | /** |
| 89 | * $length_unit Represents a standard length unit. See [MeasurementUnitLength](#type-measurementunitlength) for possible values |
| 90 | * @var string |
| 91 | */ |
| 92 | protected $length_unit; |
| 93 | /** |
| 94 | * $volume_unit Represents a standard volume unit. See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values |
| 95 | * @var string |
| 96 | */ |
| 97 | protected $volume_unit; |
| 98 | /** |
| 99 | * $weight_unit Represents a standard unit of weight or mass. See [MeasurementUnitWeight](#type-measurementunitweight) for possible values |
| 100 | * @var string |
| 101 | */ |
| 102 | protected $weight_unit; |
| 103 | /** |
| 104 | * $generic_unit Reserved for API integrations that lack the ability to specify a real measurement unit See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values |
| 105 | * @var string |
| 106 | */ |
| 107 | protected $generic_unit; |
| 108 | /** |
| 109 | * $type Represents the type of the measurement unit. See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values |
| 110 | * @var string |
| 111 | */ |
| 112 | protected $type; |
| 113 | |
| 114 | /** |
| 115 | * Constructor |
| 116 | * @param mixed[] $data Associated array of property value initializing the model |
| 117 | */ |
| 118 | public function __construct(array $data = null) |
| 119 | { |
| 120 | if ($data != null) { |
| 121 | if (isset($data["custom_unit"])) { |
| 122 | $this->custom_unit = $data["custom_unit"]; |
| 123 | } else { |
| 124 | $this->custom_unit = null; |
| 125 | } |
| 126 | if (isset($data["area_unit"])) { |
| 127 | $this->area_unit = $data["area_unit"]; |
| 128 | } else { |
| 129 | $this->area_unit = null; |
| 130 | } |
| 131 | if (isset($data["length_unit"])) { |
| 132 | $this->length_unit = $data["length_unit"]; |
| 133 | } else { |
| 134 | $this->length_unit = null; |
| 135 | } |
| 136 | if (isset($data["volume_unit"])) { |
| 137 | $this->volume_unit = $data["volume_unit"]; |
| 138 | } else { |
| 139 | $this->volume_unit = null; |
| 140 | } |
| 141 | if (isset($data["weight_unit"])) { |
| 142 | $this->weight_unit = $data["weight_unit"]; |
| 143 | } else { |
| 144 | $this->weight_unit = null; |
| 145 | } |
| 146 | if (isset($data["generic_unit"])) { |
| 147 | $this->generic_unit = $data["generic_unit"]; |
| 148 | } else { |
| 149 | $this->generic_unit = null; |
| 150 | } |
| 151 | if (isset($data["type"])) { |
| 152 | $this->type = $data["type"]; |
| 153 | } else { |
| 154 | $this->type = null; |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | /** |
| 159 | * Gets custom_unit |
| 160 | * @return \SquareConnect\Model\MeasurementUnitCustom |
| 161 | */ |
| 162 | public function getCustomUnit() |
| 163 | { |
| 164 | return $this->custom_unit; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Sets custom_unit |
| 169 | * @param \SquareConnect\Model\MeasurementUnitCustom $custom_unit A custom unit of measurement defined by the seller using the Point of Sale app or ad-hoc as an order line item. |
| 170 | * @return $this |
| 171 | */ |
| 172 | public function setCustomUnit($custom_unit) |
| 173 | { |
| 174 | $this->custom_unit = $custom_unit; |
| 175 | return $this; |
| 176 | } |
| 177 | /** |
| 178 | * Gets area_unit |
| 179 | * @return string |
| 180 | */ |
| 181 | public function getAreaUnit() |
| 182 | { |
| 183 | return $this->area_unit; |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Sets area_unit |
| 188 | * @param string $area_unit Represents a standard area unit. See [MeasurementUnitArea](#type-measurementunitarea) for possible values |
| 189 | * @return $this |
| 190 | */ |
| 191 | public function setAreaUnit($area_unit) |
| 192 | { |
| 193 | $this->area_unit = $area_unit; |
| 194 | return $this; |
| 195 | } |
| 196 | /** |
| 197 | * Gets length_unit |
| 198 | * @return string |
| 199 | */ |
| 200 | public function getLengthUnit() |
| 201 | { |
| 202 | return $this->length_unit; |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Sets length_unit |
| 207 | * @param string $length_unit Represents a standard length unit. See [MeasurementUnitLength](#type-measurementunitlength) for possible values |
| 208 | * @return $this |
| 209 | */ |
| 210 | public function setLengthUnit($length_unit) |
| 211 | { |
| 212 | $this->length_unit = $length_unit; |
| 213 | return $this; |
| 214 | } |
| 215 | /** |
| 216 | * Gets volume_unit |
| 217 | * @return string |
| 218 | */ |
| 219 | public function getVolumeUnit() |
| 220 | { |
| 221 | return $this->volume_unit; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Sets volume_unit |
| 226 | * @param string $volume_unit Represents a standard volume unit. See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values |
| 227 | * @return $this |
| 228 | */ |
| 229 | public function setVolumeUnit($volume_unit) |
| 230 | { |
| 231 | $this->volume_unit = $volume_unit; |
| 232 | return $this; |
| 233 | } |
| 234 | /** |
| 235 | * Gets weight_unit |
| 236 | * @return string |
| 237 | */ |
| 238 | public function getWeightUnit() |
| 239 | { |
| 240 | return $this->weight_unit; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Sets weight_unit |
| 245 | * @param string $weight_unit Represents a standard unit of weight or mass. See [MeasurementUnitWeight](#type-measurementunitweight) for possible values |
| 246 | * @return $this |
| 247 | */ |
| 248 | public function setWeightUnit($weight_unit) |
| 249 | { |
| 250 | $this->weight_unit = $weight_unit; |
| 251 | return $this; |
| 252 | } |
| 253 | /** |
| 254 | * Gets generic_unit |
| 255 | * @return string |
| 256 | */ |
| 257 | public function getGenericUnit() |
| 258 | { |
| 259 | return $this->generic_unit; |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * Sets generic_unit |
| 264 | * @param string $generic_unit Reserved for API integrations that lack the ability to specify a real measurement unit See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values |
| 265 | * @return $this |
| 266 | */ |
| 267 | public function setGenericUnit($generic_unit) |
| 268 | { |
| 269 | $this->generic_unit = $generic_unit; |
| 270 | return $this; |
| 271 | } |
| 272 | /** |
| 273 | * Gets type |
| 274 | * @return string |
| 275 | */ |
| 276 | public function getType() |
| 277 | { |
| 278 | return $this->type; |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Sets type |
| 283 | * @param string $type Represents the type of the measurement unit. See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values |
| 284 | * @return $this |
| 285 | */ |
| 286 | public function setType($type) |
| 287 | { |
| 288 | $this->type = $type; |
| 289 | return $this; |
| 290 | } |
| 291 | /** |
| 292 | * Returns true if offset exists. False otherwise. |
| 293 | * @param integer $offset Offset |
| 294 | * @return boolean |
| 295 | */ |
| 296 | public function offsetExists($offset) |
| 297 | { |
| 298 | return isset($this->$offset); |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Gets offset. |
| 303 | * @param integer $offset Offset |
| 304 | * @return mixed |
| 305 | */ |
| 306 | public function offsetGet($offset) |
| 307 | { |
| 308 | return $this->$offset; |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Sets value based on offset. |
| 313 | * @param integer $offset Offset |
| 314 | * @param mixed $value Value to be set |
| 315 | * @return void |
| 316 | */ |
| 317 | public function offsetSet($offset, $value) |
| 318 | { |
| 319 | $this->$offset = $value; |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * Unsets offset. |
| 324 | * @param integer $offset Offset |
| 325 | * @return void |
| 326 | */ |
| 327 | public function offsetUnset($offset) |
| 328 | { |
| 329 | unset($this->$offset); |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Gets the string presentation of the object |
| 334 | * @return string |
| 335 | */ |
| 336 | public function __toString() |
| 337 | { |
| 338 | if (defined('JSON_PRETTY_PRINT')) { |
| 339 | return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); |
| 340 | } else { |
| 341 | return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this)); |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 |