PostApiV3Users200ResponseData.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <?php
  2. /**
  3. * PostApiV3Users200ResponseData
  4. *
  5. * PHP version 8.1
  6. *
  7. * @category Class
  8. * @package WikipaliApi
  9. * @author OpenAPI Generator team
  10. * @link https://openapi-generator.tech
  11. */
  12. /**
  13. * MINT API
  14. *
  15. * International Academy Of Pali Tipitaka(国际巴利三藏学院) 由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
  16. *
  17. * The version of the OpenAPI document: 2026.10.8
  18. * Generated by: https://openapi-generator.tech
  19. * Generator version: 7.25.0
  20. */
  21. /**
  22. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  23. * https://openapi-generator.tech
  24. * Do not edit the class manually.
  25. */
  26. namespace WikipaliApi\Model;
  27. use \ArrayAccess;
  28. use \WikipaliApi\ObjectSerializer;
  29. /**
  30. * PostApiV3Users200ResponseData Class Doc Comment
  31. *
  32. * @category Class
  33. * @package WikipaliApi
  34. * @author OpenAPI Generator team
  35. * @link https://openapi-generator.tech
  36. * @implements \ArrayAccess<string, mixed>
  37. */
  38. class PostApiV3Users200ResponseData implements ModelInterface, ArrayAccess, \JsonSerializable
  39. {
  40. public const DISCRIMINATOR = null;
  41. /**
  42. * The original name of the model.
  43. *
  44. * @var string
  45. */
  46. protected static $openAPIModelName = 'post_api_v3_users_200_response_data';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'id' => 'string',
  54. 'username' => 'string',
  55. 'nickname' => 'string',
  56. 'email' => 'string',
  57. 'created_at' => 'string'
  58. ];
  59. /**
  60. * Array of property to format mappings. Used for (de)serialization
  61. *
  62. * @var string[]
  63. * @phpstan-var array<string, string|null>
  64. * @psalm-var array<string, string|null>
  65. */
  66. protected static $openAPIFormats = [
  67. 'id' => null,
  68. 'username' => null,
  69. 'nickname' => null,
  70. 'email' => null,
  71. 'created_at' => null
  72. ];
  73. /**
  74. * Array of nullable properties. Used for (de)serialization
  75. *
  76. * @var boolean[]
  77. */
  78. protected static array $openAPINullables = [
  79. 'id' => false,
  80. 'username' => false,
  81. 'nickname' => false,
  82. 'email' => false,
  83. 'created_at' => true
  84. ];
  85. /**
  86. * If a nullable field gets set to null, insert it here
  87. *
  88. * @var boolean[]
  89. */
  90. protected array $openAPINullablesSetToNull = [];
  91. /**
  92. * Array of property to type mappings. Used for (de)serialization
  93. *
  94. * @return array
  95. */
  96. public static function openAPITypes()
  97. {
  98. return self::$openAPITypes;
  99. }
  100. /**
  101. * Array of property to format mappings. Used for (de)serialization
  102. *
  103. * @return array
  104. */
  105. public static function openAPIFormats()
  106. {
  107. return self::$openAPIFormats;
  108. }
  109. /**
  110. * Array of nullable properties
  111. *
  112. * @return array
  113. */
  114. protected static function openAPINullables(): array
  115. {
  116. return self::$openAPINullables;
  117. }
  118. /**
  119. * Array of nullable field names deliberately set to null
  120. *
  121. * @return boolean[]
  122. */
  123. private function getOpenAPINullablesSetToNull(): array
  124. {
  125. return $this->openAPINullablesSetToNull;
  126. }
  127. /**
  128. * Setter - Array of nullable field names deliberately set to null
  129. *
  130. * @param boolean[] $openAPINullablesSetToNull
  131. */
  132. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  133. {
  134. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  135. }
  136. /**
  137. * Checks if a property is nullable
  138. *
  139. * @param string $property
  140. * @return bool
  141. */
  142. public static function isNullable(string $property): bool
  143. {
  144. return self::openAPINullables()[$property] ?? false;
  145. }
  146. /**
  147. * Checks if a nullable property is set to null.
  148. *
  149. * @param string $property
  150. * @return bool
  151. */
  152. public function isNullableSetToNull(string $property): bool
  153. {
  154. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  155. }
  156. /**
  157. * Array of attributes where the key is the local name,
  158. * and the value is the original name
  159. *
  160. * @var string[]
  161. */
  162. protected static $attributeMap = [
  163. 'id' => 'id',
  164. 'username' => 'username',
  165. 'nickname' => 'nickname',
  166. 'email' => 'email',
  167. 'created_at' => 'created_at'
  168. ];
  169. /**
  170. * Array of attributes to setter functions (for deserialization of responses)
  171. *
  172. * @var string[]
  173. */
  174. protected static $setters = [
  175. 'id' => 'setId',
  176. 'username' => 'setUsername',
  177. 'nickname' => 'setNickname',
  178. 'email' => 'setEmail',
  179. 'created_at' => 'setCreatedAt'
  180. ];
  181. /**
  182. * Array of attributes to getter functions (for serialization of requests)
  183. *
  184. * @var string[]
  185. */
  186. protected static $getters = [
  187. 'id' => 'getId',
  188. 'username' => 'getUsername',
  189. 'nickname' => 'getNickname',
  190. 'email' => 'getEmail',
  191. 'created_at' => 'getCreatedAt'
  192. ];
  193. /**
  194. * Array of attributes where the key is the local name,
  195. * and the value is the original name
  196. *
  197. * @return array
  198. */
  199. public static function attributeMap()
  200. {
  201. return self::$attributeMap;
  202. }
  203. /**
  204. * Array of attributes to setter functions (for deserialization of responses)
  205. *
  206. * @return array
  207. */
  208. public static function setters()
  209. {
  210. return self::$setters;
  211. }
  212. /**
  213. * Array of attributes to getter functions (for serialization of requests)
  214. *
  215. * @return array
  216. */
  217. public static function getters()
  218. {
  219. return self::$getters;
  220. }
  221. /**
  222. * The original name of the model.
  223. *
  224. * @return string
  225. */
  226. public function getModelName()
  227. {
  228. return self::$openAPIModelName;
  229. }
  230. /**
  231. * Associative array for storing property values
  232. *
  233. * @var mixed[]
  234. */
  235. protected $container = [];
  236. /**
  237. * Constructor
  238. *
  239. * @param mixed[]|null $data Associated array of property values
  240. * initializing the model
  241. */
  242. public function __construct(?array $data = null)
  243. {
  244. $this->setIfExists('id', $data ?? [], null);
  245. $this->setIfExists('username', $data ?? [], null);
  246. $this->setIfExists('nickname', $data ?? [], null);
  247. $this->setIfExists('email', $data ?? [], null);
  248. $this->setIfExists('created_at', $data ?? [], null);
  249. }
  250. /**
  251. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  252. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  253. * $this->openAPINullablesSetToNull array
  254. *
  255. * @param string $variableName
  256. * @param array $fields
  257. * @param mixed $defaultValue
  258. */
  259. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  260. {
  261. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  262. $this->openAPINullablesSetToNull[] = $variableName;
  263. }
  264. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  265. }
  266. /**
  267. * Show all the invalid properties with reasons.
  268. *
  269. * @return array invalid properties with reasons
  270. */
  271. public function listInvalidProperties()
  272. {
  273. $invalidProperties = [];
  274. return $invalidProperties;
  275. }
  276. /**
  277. * Validate all the properties in the model
  278. * return true if all passed
  279. *
  280. * @return bool True if all properties are valid
  281. */
  282. public function valid()
  283. {
  284. return count($this->listInvalidProperties()) === 0;
  285. }
  286. /**
  287. * Gets id
  288. *
  289. * @return string|null
  290. */
  291. public function getId()
  292. {
  293. return $this->container['id'];
  294. }
  295. /**
  296. * Sets id
  297. *
  298. * @param string|null $id id
  299. *
  300. * @return self
  301. */
  302. public function setId($id)
  303. {
  304. if (is_null($id)) {
  305. throw new \InvalidArgumentException('non-nullable id cannot be null');
  306. }
  307. $this->container['id'] = $id;
  308. return $this;
  309. }
  310. /**
  311. * Gets username
  312. *
  313. * @return string|null
  314. */
  315. public function getUsername()
  316. {
  317. return $this->container['username'];
  318. }
  319. /**
  320. * Sets username
  321. *
  322. * @param string|null $username username
  323. *
  324. * @return self
  325. */
  326. public function setUsername($username)
  327. {
  328. if (is_null($username)) {
  329. throw new \InvalidArgumentException('non-nullable username cannot be null');
  330. }
  331. $this->container['username'] = $username;
  332. return $this;
  333. }
  334. /**
  335. * Gets nickname
  336. *
  337. * @return string|null
  338. */
  339. public function getNickname()
  340. {
  341. return $this->container['nickname'];
  342. }
  343. /**
  344. * Sets nickname
  345. *
  346. * @param string|null $nickname nickname
  347. *
  348. * @return self
  349. */
  350. public function setNickname($nickname)
  351. {
  352. if (is_null($nickname)) {
  353. throw new \InvalidArgumentException('non-nullable nickname cannot be null');
  354. }
  355. $this->container['nickname'] = $nickname;
  356. return $this;
  357. }
  358. /**
  359. * Gets email
  360. *
  361. * @return string|null
  362. */
  363. public function getEmail()
  364. {
  365. return $this->container['email'];
  366. }
  367. /**
  368. * Sets email
  369. *
  370. * @param string|null $email email
  371. *
  372. * @return self
  373. */
  374. public function setEmail($email)
  375. {
  376. if (is_null($email)) {
  377. throw new \InvalidArgumentException('non-nullable email cannot be null');
  378. }
  379. $this->container['email'] = $email;
  380. return $this;
  381. }
  382. /**
  383. * Gets created_at
  384. *
  385. * @return string|null
  386. */
  387. public function getCreatedAt()
  388. {
  389. return $this->container['created_at'];
  390. }
  391. /**
  392. * Sets created_at
  393. *
  394. * @param string|null $created_at created_at
  395. *
  396. * @return self
  397. */
  398. public function setCreatedAt($created_at)
  399. {
  400. if (is_null($created_at)) {
  401. array_push($this->openAPINullablesSetToNull, 'created_at');
  402. } else {
  403. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  404. $index = array_search('created_at', $nullablesSetToNull);
  405. if ($index !== FALSE) {
  406. unset($nullablesSetToNull[$index]);
  407. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  408. }
  409. }
  410. $this->container['created_at'] = $created_at;
  411. return $this;
  412. }
  413. /**
  414. * Returns true if offset exists. False otherwise.
  415. *
  416. * @param integer|string $offset Offset
  417. *
  418. * @return boolean
  419. */
  420. public function offsetExists(mixed $offset): bool
  421. {
  422. return isset($this->container[$offset]);
  423. }
  424. /**
  425. * Gets offset.
  426. *
  427. * @param integer|string $offset Offset
  428. *
  429. * @return mixed|null
  430. */
  431. #[\ReturnTypeWillChange]
  432. public function offsetGet(mixed $offset)
  433. {
  434. return $this->container[$offset] ?? null;
  435. }
  436. /**
  437. * Sets value based on offset.
  438. *
  439. * @param int|null $offset Offset
  440. * @param mixed $value Value to be set
  441. *
  442. * @return void
  443. */
  444. public function offsetSet($offset, $value): void
  445. {
  446. if (is_null($offset)) {
  447. $this->container[] = $value;
  448. } else {
  449. $this->container[$offset] = $value;
  450. }
  451. }
  452. /**
  453. * Unsets offset.
  454. *
  455. * @param integer|string $offset Offset
  456. *
  457. * @return void
  458. */
  459. public function offsetUnset(mixed $offset): void
  460. {
  461. unset($this->container[$offset]);
  462. }
  463. /**
  464. * Serializes the object to a value that can be serialized natively by json_encode().
  465. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  466. *
  467. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  468. * of any type other than a resource.
  469. */
  470. #[\ReturnTypeWillChange]
  471. public function jsonSerialize()
  472. {
  473. return ObjectSerializer::sanitizeForSerialization($this);
  474. }
  475. /**
  476. * Gets the string presentation of the object
  477. *
  478. * @return string
  479. */
  480. public function __toString()
  481. {
  482. return json_encode(
  483. ObjectSerializer::sanitizeForSerialization($this),
  484. JSON_PRETTY_PRINT
  485. );
  486. }
  487. /**
  488. * Gets a header-safe presentation of the object
  489. *
  490. * @return string
  491. */
  492. public function toHeaderValue()
  493. {
  494. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  495. }
  496. }