| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | namespace Ally\PetStore\Schema; |
| 30: | |
| 31: | use \ArrayAccess; |
| 32: | use \Ally\PetStore\ObjectSerializer; |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | class User implements ModelInterface, ArrayAccess, \JsonSerializable |
| 45: | { |
| 46: | public const DISCRIMINATOR = null; |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | protected static $openAPIModelName = 'User'; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | |
| 59: | |
| 60: | protected static $openAPITypes = [ |
| 61: | 'id' => 'int', |
| 62: | 'username' => 'string', |
| 63: | 'first_name' => 'string', |
| 64: | 'last_name' => 'string', |
| 65: | 'email' => 'string', |
| 66: | 'password' => 'string', |
| 67: | 'phone' => 'string', |
| 68: | 'user_status' => 'int' |
| 69: | ]; |
| 70: | |
| 71: | |
| 72: | |
| 73: | |
| 74: | |
| 75: | |
| 76: | |
| 77: | |
| 78: | protected static $openAPIFormats = [ |
| 79: | 'id' => 'int64', |
| 80: | 'username' => null, |
| 81: | 'first_name' => null, |
| 82: | 'last_name' => null, |
| 83: | 'email' => null, |
| 84: | 'password' => null, |
| 85: | 'phone' => null, |
| 86: | 'user_status' => 'int32' |
| 87: | ]; |
| 88: | |
| 89: | |
| 90: | |
| 91: | |
| 92: | |
| 93: | |
| 94: | protected static array $openAPINullables = [ |
| 95: | 'id' => false, |
| 96: | 'username' => false, |
| 97: | 'first_name' => false, |
| 98: | 'last_name' => false, |
| 99: | 'email' => false, |
| 100: | 'password' => false, |
| 101: | 'phone' => false, |
| 102: | 'user_status' => false |
| 103: | ]; |
| 104: | |
| 105: | |
| 106: | |
| 107: | |
| 108: | |
| 109: | |
| 110: | protected array $openAPINullablesSetToNull = []; |
| 111: | |
| 112: | |
| 113: | |
| 114: | |
| 115: | |
| 116: | |
| 117: | public static function openAPITypes() |
| 118: | { |
| 119: | return self::$openAPITypes; |
| 120: | } |
| 121: | |
| 122: | |
| 123: | |
| 124: | |
| 125: | |
| 126: | |
| 127: | public static function openAPIFormats() |
| 128: | { |
| 129: | return self::$openAPIFormats; |
| 130: | } |
| 131: | |
| 132: | |
| 133: | |
| 134: | |
| 135: | |
| 136: | |
| 137: | protected static function openAPINullables(): array |
| 138: | { |
| 139: | return self::$openAPINullables; |
| 140: | } |
| 141: | |
| 142: | |
| 143: | |
| 144: | |
| 145: | |
| 146: | |
| 147: | private function getOpenAPINullablesSetToNull(): array |
| 148: | { |
| 149: | return $this->openAPINullablesSetToNull; |
| 150: | } |
| 151: | |
| 152: | |
| 153: | |
| 154: | |
| 155: | |
| 156: | |
| 157: | |
| 158: | public static function isNullable(string $property): bool |
| 159: | { |
| 160: | return self::openAPINullables()[$property] ?? false; |
| 161: | } |
| 162: | |
| 163: | |
| 164: | |
| 165: | |
| 166: | |
| 167: | |
| 168: | |
| 169: | public function isNullableSetToNull(string $property): bool |
| 170: | { |
| 171: | return in_array($property, $this->getOpenAPINullablesSetToNull(), true); |
| 172: | } |
| 173: | |
| 174: | |
| 175: | |
| 176: | |
| 177: | |
| 178: | |
| 179: | |
| 180: | protected static $attributeMap = [ |
| 181: | 'id' => 'id', |
| 182: | 'username' => 'username', |
| 183: | 'first_name' => 'firstName', |
| 184: | 'last_name' => 'lastName', |
| 185: | 'email' => 'email', |
| 186: | 'password' => 'password', |
| 187: | 'phone' => 'phone', |
| 188: | 'user_status' => 'userStatus' |
| 189: | ]; |
| 190: | |
| 191: | |
| 192: | |
| 193: | |
| 194: | |
| 195: | |
| 196: | protected static $setters = [ |
| 197: | 'id' => 'setId', |
| 198: | 'username' => 'setUsername', |
| 199: | 'first_name' => 'setFirstName', |
| 200: | 'last_name' => 'setLastName', |
| 201: | 'email' => 'setEmail', |
| 202: | 'password' => 'setPassword', |
| 203: | 'phone' => 'setPhone', |
| 204: | 'user_status' => 'setUserStatus' |
| 205: | ]; |
| 206: | |
| 207: | |
| 208: | |
| 209: | |
| 210: | |
| 211: | |
| 212: | protected static $getters = [ |
| 213: | 'id' => 'getId', |
| 214: | 'username' => 'getUsername', |
| 215: | 'first_name' => 'getFirstName', |
| 216: | 'last_name' => 'getLastName', |
| 217: | 'email' => 'getEmail', |
| 218: | 'password' => 'getPassword', |
| 219: | 'phone' => 'getPhone', |
| 220: | 'user_status' => 'getUserStatus' |
| 221: | ]; |
| 222: | |
| 223: | |
| 224: | |
| 225: | |
| 226: | |
| 227: | |
| 228: | |
| 229: | public static function attributeMap() |
| 230: | { |
| 231: | return self::$attributeMap; |
| 232: | } |
| 233: | |
| 234: | |
| 235: | |
| 236: | |
| 237: | |
| 238: | |
| 239: | public static function setters() |
| 240: | { |
| 241: | return self::$setters; |
| 242: | } |
| 243: | |
| 244: | |
| 245: | |
| 246: | |
| 247: | |
| 248: | |
| 249: | public static function getters() |
| 250: | { |
| 251: | return self::$getters; |
| 252: | } |
| 253: | |
| 254: | |
| 255: | |
| 256: | |
| 257: | |
| 258: | |
| 259: | public function getModelName() |
| 260: | { |
| 261: | return self::$openAPIModelName; |
| 262: | } |
| 263: | |
| 264: | |
| 265: | |
| 266: | |
| 267: | |
| 268: | |
| 269: | |
| 270: | protected $container = []; |
| 271: | |
| 272: | |
| 273: | |
| 274: | |
| 275: | |
| 276: | |
| 277: | |
| 278: | public function __construct(array $data = null) |
| 279: | { |
| 280: | $this->setIfExists('id', $data ?? [], null); |
| 281: | $this->setIfExists('username', $data ?? [], null); |
| 282: | $this->setIfExists('first_name', $data ?? [], null); |
| 283: | $this->setIfExists('last_name', $data ?? [], null); |
| 284: | $this->setIfExists('email', $data ?? [], null); |
| 285: | $this->setIfExists('password', $data ?? [], null); |
| 286: | $this->setIfExists('phone', $data ?? [], null); |
| 287: | $this->setIfExists('user_status', $data ?? [], null); |
| 288: | } |
| 289: | |
| 290: | |
| 291: | |
| 292: | |
| 293: | |
| 294: | |
| 295: | |
| 296: | |
| 297: | |
| 298: | |
| 299: | private function setIfExists(string $variableName, array $fields, $defaultValue): void |
| 300: | { |
| 301: | if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { |
| 302: | $this->openAPINullablesSetToNull[] = $variableName; |
| 303: | } |
| 304: | |
| 305: | $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; |
| 306: | } |
| 307: | |
| 308: | |
| 309: | |
| 310: | |
| 311: | |
| 312: | |
| 313: | public function listInvalidProperties() |
| 314: | { |
| 315: | $invalidProperties = []; |
| 316: | |
| 317: | return $invalidProperties; |
| 318: | } |
| 319: | |
| 320: | |
| 321: | |
| 322: | |
| 323: | |
| 324: | |
| 325: | |
| 326: | public function valid() |
| 327: | { |
| 328: | return count($this->listInvalidProperties()) === 0; |
| 329: | } |
| 330: | |
| 331: | |
| 332: | |
| 333: | |
| 334: | |
| 335: | |
| 336: | |
| 337: | public function getId() |
| 338: | { |
| 339: | return $this->container['id']; |
| 340: | } |
| 341: | |
| 342: | |
| 343: | |
| 344: | |
| 345: | |
| 346: | |
| 347: | |
| 348: | |
| 349: | public function setId($id) |
| 350: | { |
| 351: | |
| 352: | if (is_null($id)) { |
| 353: | throw new \InvalidArgumentException('non-nullable id cannot be null'); |
| 354: | } |
| 355: | |
| 356: | $this->container['id'] = $id; |
| 357: | |
| 358: | return $this; |
| 359: | } |
| 360: | |
| 361: | |
| 362: | |
| 363: | |
| 364: | |
| 365: | |
| 366: | public function getUsername() |
| 367: | { |
| 368: | return $this->container['username']; |
| 369: | } |
| 370: | |
| 371: | |
| 372: | |
| 373: | |
| 374: | |
| 375: | |
| 376: | |
| 377: | |
| 378: | public function setUsername($username) |
| 379: | { |
| 380: | |
| 381: | if (is_null($username)) { |
| 382: | throw new \InvalidArgumentException('non-nullable username cannot be null'); |
| 383: | } |
| 384: | |
| 385: | $this->container['username'] = $username; |
| 386: | |
| 387: | return $this; |
| 388: | } |
| 389: | |
| 390: | |
| 391: | |
| 392: | |
| 393: | |
| 394: | |
| 395: | public function getFirstName() |
| 396: | { |
| 397: | return $this->container['first_name']; |
| 398: | } |
| 399: | |
| 400: | |
| 401: | |
| 402: | |
| 403: | |
| 404: | |
| 405: | |
| 406: | |
| 407: | public function setFirstName($first_name) |
| 408: | { |
| 409: | |
| 410: | if (is_null($first_name)) { |
| 411: | throw new \InvalidArgumentException('non-nullable first_name cannot be null'); |
| 412: | } |
| 413: | |
| 414: | $this->container['first_name'] = $first_name; |
| 415: | |
| 416: | return $this; |
| 417: | } |
| 418: | |
| 419: | |
| 420: | |
| 421: | |
| 422: | |
| 423: | |
| 424: | public function getLastName() |
| 425: | { |
| 426: | return $this->container['last_name']; |
| 427: | } |
| 428: | |
| 429: | |
| 430: | |
| 431: | |
| 432: | |
| 433: | |
| 434: | |
| 435: | |
| 436: | public function setLastName($last_name) |
| 437: | { |
| 438: | |
| 439: | if (is_null($last_name)) { |
| 440: | throw new \InvalidArgumentException('non-nullable last_name cannot be null'); |
| 441: | } |
| 442: | |
| 443: | $this->container['last_name'] = $last_name; |
| 444: | |
| 445: | return $this; |
| 446: | } |
| 447: | |
| 448: | |
| 449: | |
| 450: | |
| 451: | |
| 452: | |
| 453: | public function getEmail() |
| 454: | { |
| 455: | return $this->container['email']; |
| 456: | } |
| 457: | |
| 458: | |
| 459: | |
| 460: | |
| 461: | |
| 462: | |
| 463: | |
| 464: | |
| 465: | public function setEmail($email) |
| 466: | { |
| 467: | |
| 468: | if (is_null($email)) { |
| 469: | throw new \InvalidArgumentException('non-nullable email cannot be null'); |
| 470: | } |
| 471: | |
| 472: | $this->container['email'] = $email; |
| 473: | |
| 474: | return $this; |
| 475: | } |
| 476: | |
| 477: | |
| 478: | |
| 479: | |
| 480: | |
| 481: | |
| 482: | public function getPassword() |
| 483: | { |
| 484: | return $this->container['password']; |
| 485: | } |
| 486: | |
| 487: | |
| 488: | |
| 489: | |
| 490: | |
| 491: | |
| 492: | |
| 493: | |
| 494: | public function setPassword($password) |
| 495: | { |
| 496: | |
| 497: | if (is_null($password)) { |
| 498: | throw new \InvalidArgumentException('non-nullable password cannot be null'); |
| 499: | } |
| 500: | |
| 501: | $this->container['password'] = $password; |
| 502: | |
| 503: | return $this; |
| 504: | } |
| 505: | |
| 506: | |
| 507: | |
| 508: | |
| 509: | |
| 510: | |
| 511: | public function getPhone() |
| 512: | { |
| 513: | return $this->container['phone']; |
| 514: | } |
| 515: | |
| 516: | |
| 517: | |
| 518: | |
| 519: | |
| 520: | |
| 521: | |
| 522: | |
| 523: | public function setPhone($phone) |
| 524: | { |
| 525: | |
| 526: | if (is_null($phone)) { |
| 527: | throw new \InvalidArgumentException('non-nullable phone cannot be null'); |
| 528: | } |
| 529: | |
| 530: | $this->container['phone'] = $phone; |
| 531: | |
| 532: | return $this; |
| 533: | } |
| 534: | |
| 535: | |
| 536: | |
| 537: | |
| 538: | |
| 539: | |
| 540: | public function getUserStatus() |
| 541: | { |
| 542: | return $this->container['user_status']; |
| 543: | } |
| 544: | |
| 545: | |
| 546: | |
| 547: | |
| 548: | |
| 549: | |
| 550: | |
| 551: | |
| 552: | public function setUserStatus($user_status) |
| 553: | { |
| 554: | |
| 555: | if (is_null($user_status)) { |
| 556: | throw new \InvalidArgumentException('non-nullable user_status cannot be null'); |
| 557: | } |
| 558: | |
| 559: | $this->container['user_status'] = $user_status; |
| 560: | |
| 561: | return $this; |
| 562: | } |
| 563: | |
| 564: | |
| 565: | |
| 566: | |
| 567: | |
| 568: | |
| 569: | |
| 570: | public function offsetExists($offset): bool |
| 571: | { |
| 572: | return isset($this->container[$offset]); |
| 573: | } |
| 574: | |
| 575: | |
| 576: | |
| 577: | |
| 578: | |
| 579: | |
| 580: | |
| 581: | |
| 582: | #[\ReturnTypeWillChange] |
| 583: | public function offsetGet($offset) |
| 584: | { |
| 585: | return $this->container[$offset] ?? null; |
| 586: | } |
| 587: | |
| 588: | |
| 589: | |
| 590: | |
| 591: | |
| 592: | |
| 593: | |
| 594: | |
| 595: | |
| 596: | public function offsetSet($offset, $value): void |
| 597: | { |
| 598: | if (is_null($offset)) { |
| 599: | $this->container[] = $value; |
| 600: | } else { |
| 601: | $this->container[$offset] = $value; |
| 602: | } |
| 603: | } |
| 604: | |
| 605: | |
| 606: | |
| 607: | |
| 608: | |
| 609: | |
| 610: | |
| 611: | |
| 612: | public function offsetUnset($offset): void |
| 613: | { |
| 614: | unset($this->container[$offset]); |
| 615: | } |
| 616: | |
| 617: | |
| 618: | |
| 619: | |
| 620: | |
| 621: | |
| 622: | |
| 623: | |
| 624: | #[\ReturnTypeWillChange] |
| 625: | public function jsonSerialize() |
| 626: | { |
| 627: | return ObjectSerializer::sanitizeForSerialization($this); |
| 628: | } |
| 629: | |
| 630: | |
| 631: | |
| 632: | |
| 633: | |
| 634: | |
| 635: | public function __toString() |
| 636: | { |
| 637: | return json_encode( |
| 638: | ObjectSerializer::sanitizeForSerialization($this), |
| 639: | JSON_PRETTY_PRINT |
| 640: | ); |
| 641: | } |
| 642: | |
| 643: | |
| 644: | |
| 645: | |
| 646: | |
| 647: | |
| 648: | public function toHeaderValue() |
| 649: | { |
| 650: | return json_encode(ObjectSerializer::sanitizeForSerialization($this)); |
| 651: | } |
| 652: | } |
| 653: | |
| 654: | |
| 655: | |