GetApiV3MeReactions200ResponseDataInnerUser.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. <?php
  2. /**
  3. * GetApiV3MeReactions200ResponseDataInnerUser
  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.9.28
  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. * GetApiV3MeReactions200ResponseDataInnerUser 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 GetApiV3MeReactions200ResponseDataInnerUser 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 = 'get_api_v3_me_reactions_200_response_data_inner_user';
  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. 'nick_name' => 'string',
  55. 'user_name' => 'string',
  56. 'real_name' => 'string',
  57. 'sn' => 'int',
  58. 'avatar' => 'string',
  59. 'roles' => 'string[]'
  60. ];
  61. /**
  62. * Array of property to format mappings. Used for (de)serialization
  63. *
  64. * @var string[]
  65. * @phpstan-var array<string, string|null>
  66. * @psalm-var array<string, string|null>
  67. */
  68. protected static $openAPIFormats = [
  69. 'id' => null,
  70. 'nick_name' => null,
  71. 'user_name' => null,
  72. 'real_name' => null,
  73. 'sn' => null,
  74. 'avatar' => null,
  75. 'roles' => null
  76. ];
  77. /**
  78. * Array of nullable properties. Used for (de)serialization
  79. *
  80. * @var boolean[]
  81. */
  82. protected static array $openAPINullables = [
  83. 'id' => false,
  84. 'nick_name' => false,
  85. 'user_name' => false,
  86. 'real_name' => false,
  87. 'sn' => false,
  88. 'avatar' => false,
  89. 'roles' => false
  90. ];
  91. /**
  92. * If a nullable field gets set to null, insert it here
  93. *
  94. * @var boolean[]
  95. */
  96. protected array $openAPINullablesSetToNull = [];
  97. /**
  98. * Array of property to type mappings. Used for (de)serialization
  99. *
  100. * @return array
  101. */
  102. public static function openAPITypes()
  103. {
  104. return self::$openAPITypes;
  105. }
  106. /**
  107. * Array of property to format mappings. Used for (de)serialization
  108. *
  109. * @return array
  110. */
  111. public static function openAPIFormats()
  112. {
  113. return self::$openAPIFormats;
  114. }
  115. /**
  116. * Array of nullable properties
  117. *
  118. * @return array
  119. */
  120. protected static function openAPINullables(): array
  121. {
  122. return self::$openAPINullables;
  123. }
  124. /**
  125. * Array of nullable field names deliberately set to null
  126. *
  127. * @return boolean[]
  128. */
  129. private function getOpenAPINullablesSetToNull(): array
  130. {
  131. return $this->openAPINullablesSetToNull;
  132. }
  133. /**
  134. * Setter - Array of nullable field names deliberately set to null
  135. *
  136. * @param boolean[] $openAPINullablesSetToNull
  137. */
  138. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  139. {
  140. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  141. }
  142. /**
  143. * Checks if a property is nullable
  144. *
  145. * @param string $property
  146. * @return bool
  147. */
  148. public static function isNullable(string $property): bool
  149. {
  150. return self::openAPINullables()[$property] ?? false;
  151. }
  152. /**
  153. * Checks if a nullable property is set to null.
  154. *
  155. * @param string $property
  156. * @return bool
  157. */
  158. public function isNullableSetToNull(string $property): bool
  159. {
  160. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  161. }
  162. /**
  163. * Array of attributes where the key is the local name,
  164. * and the value is the original name
  165. *
  166. * @var string[]
  167. */
  168. protected static $attributeMap = [
  169. 'id' => 'id',
  170. 'nick_name' => 'nickName',
  171. 'user_name' => 'userName',
  172. 'real_name' => 'realName',
  173. 'sn' => 'sn',
  174. 'avatar' => 'avatar',
  175. 'roles' => 'roles'
  176. ];
  177. /**
  178. * Array of attributes to setter functions (for deserialization of responses)
  179. *
  180. * @var string[]
  181. */
  182. protected static $setters = [
  183. 'id' => 'setId',
  184. 'nick_name' => 'setNickName',
  185. 'user_name' => 'setUserName',
  186. 'real_name' => 'setRealName',
  187. 'sn' => 'setSn',
  188. 'avatar' => 'setAvatar',
  189. 'roles' => 'setRoles'
  190. ];
  191. /**
  192. * Array of attributes to getter functions (for serialization of requests)
  193. *
  194. * @var string[]
  195. */
  196. protected static $getters = [
  197. 'id' => 'getId',
  198. 'nick_name' => 'getNickName',
  199. 'user_name' => 'getUserName',
  200. 'real_name' => 'getRealName',
  201. 'sn' => 'getSn',
  202. 'avatar' => 'getAvatar',
  203. 'roles' => 'getRoles'
  204. ];
  205. /**
  206. * Array of attributes where the key is the local name,
  207. * and the value is the original name
  208. *
  209. * @return array
  210. */
  211. public static function attributeMap()
  212. {
  213. return self::$attributeMap;
  214. }
  215. /**
  216. * Array of attributes to setter functions (for deserialization of responses)
  217. *
  218. * @return array
  219. */
  220. public static function setters()
  221. {
  222. return self::$setters;
  223. }
  224. /**
  225. * Array of attributes to getter functions (for serialization of requests)
  226. *
  227. * @return array
  228. */
  229. public static function getters()
  230. {
  231. return self::$getters;
  232. }
  233. /**
  234. * The original name of the model.
  235. *
  236. * @return string
  237. */
  238. public function getModelName()
  239. {
  240. return self::$openAPIModelName;
  241. }
  242. /**
  243. * Associative array for storing property values
  244. *
  245. * @var mixed[]
  246. */
  247. protected $container = [];
  248. /**
  249. * Constructor
  250. *
  251. * @param mixed[]|null $data Associated array of property values
  252. * initializing the model
  253. */
  254. public function __construct(?array $data = null)
  255. {
  256. $this->setIfExists('id', $data ?? [], null);
  257. $this->setIfExists('nick_name', $data ?? [], null);
  258. $this->setIfExists('user_name', $data ?? [], null);
  259. $this->setIfExists('real_name', $data ?? [], null);
  260. $this->setIfExists('sn', $data ?? [], null);
  261. $this->setIfExists('avatar', $data ?? [], null);
  262. $this->setIfExists('roles', $data ?? [], null);
  263. }
  264. /**
  265. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  266. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  267. * $this->openAPINullablesSetToNull array
  268. *
  269. * @param string $variableName
  270. * @param array $fields
  271. * @param mixed $defaultValue
  272. */
  273. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  274. {
  275. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  276. $this->openAPINullablesSetToNull[] = $variableName;
  277. }
  278. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  279. }
  280. /**
  281. * Show all the invalid properties with reasons.
  282. *
  283. * @return array invalid properties with reasons
  284. */
  285. public function listInvalidProperties()
  286. {
  287. $invalidProperties = [];
  288. return $invalidProperties;
  289. }
  290. /**
  291. * Validate all the properties in the model
  292. * return true if all passed
  293. *
  294. * @return bool True if all properties are valid
  295. */
  296. public function valid()
  297. {
  298. return count($this->listInvalidProperties()) === 0;
  299. }
  300. /**
  301. * Gets id
  302. *
  303. * @return string|null
  304. */
  305. public function getId()
  306. {
  307. return $this->container['id'];
  308. }
  309. /**
  310. * Sets id
  311. *
  312. * @param string|null $id id
  313. *
  314. * @return self
  315. */
  316. public function setId($id)
  317. {
  318. if (is_null($id)) {
  319. throw new \InvalidArgumentException('non-nullable id cannot be null');
  320. }
  321. $this->container['id'] = $id;
  322. return $this;
  323. }
  324. /**
  325. * Gets nick_name
  326. *
  327. * @return string|null
  328. */
  329. public function getNickName()
  330. {
  331. return $this->container['nick_name'];
  332. }
  333. /**
  334. * Sets nick_name
  335. *
  336. * @param string|null $nick_name nick_name
  337. *
  338. * @return self
  339. */
  340. public function setNickName($nick_name)
  341. {
  342. if (is_null($nick_name)) {
  343. throw new \InvalidArgumentException('non-nullable nick_name cannot be null');
  344. }
  345. $this->container['nick_name'] = $nick_name;
  346. return $this;
  347. }
  348. /**
  349. * Gets user_name
  350. *
  351. * @return string|null
  352. */
  353. public function getUserName()
  354. {
  355. return $this->container['user_name'];
  356. }
  357. /**
  358. * Sets user_name
  359. *
  360. * @param string|null $user_name user_name
  361. *
  362. * @return self
  363. */
  364. public function setUserName($user_name)
  365. {
  366. if (is_null($user_name)) {
  367. throw new \InvalidArgumentException('non-nullable user_name cannot be null');
  368. }
  369. $this->container['user_name'] = $user_name;
  370. return $this;
  371. }
  372. /**
  373. * Gets real_name
  374. *
  375. * @return string|null
  376. */
  377. public function getRealName()
  378. {
  379. return $this->container['real_name'];
  380. }
  381. /**
  382. * Sets real_name
  383. *
  384. * @param string|null $real_name real_name
  385. *
  386. * @return self
  387. */
  388. public function setRealName($real_name)
  389. {
  390. if (is_null($real_name)) {
  391. throw new \InvalidArgumentException('non-nullable real_name cannot be null');
  392. }
  393. $this->container['real_name'] = $real_name;
  394. return $this;
  395. }
  396. /**
  397. * Gets sn
  398. *
  399. * @return int|null
  400. */
  401. public function getSn()
  402. {
  403. return $this->container['sn'];
  404. }
  405. /**
  406. * Sets sn
  407. *
  408. * @param int|null $sn sn
  409. *
  410. * @return self
  411. */
  412. public function setSn($sn)
  413. {
  414. if (is_null($sn)) {
  415. throw new \InvalidArgumentException('non-nullable sn cannot be null');
  416. }
  417. $this->container['sn'] = $sn;
  418. return $this;
  419. }
  420. /**
  421. * Gets avatar
  422. *
  423. * @return string|null
  424. */
  425. public function getAvatar()
  426. {
  427. return $this->container['avatar'];
  428. }
  429. /**
  430. * Sets avatar
  431. *
  432. * @param string|null $avatar avatar
  433. *
  434. * @return self
  435. */
  436. public function setAvatar($avatar)
  437. {
  438. if (is_null($avatar)) {
  439. throw new \InvalidArgumentException('non-nullable avatar cannot be null');
  440. }
  441. $this->container['avatar'] = $avatar;
  442. return $this;
  443. }
  444. /**
  445. * Gets roles
  446. *
  447. * @return string[]|null
  448. */
  449. public function getRoles()
  450. {
  451. return $this->container['roles'];
  452. }
  453. /**
  454. * Sets roles
  455. *
  456. * @param string[]|null $roles roles
  457. *
  458. * @return self
  459. */
  460. public function setRoles($roles)
  461. {
  462. if (is_null($roles)) {
  463. throw new \InvalidArgumentException('non-nullable roles cannot be null');
  464. }
  465. $this->container['roles'] = $roles;
  466. return $this;
  467. }
  468. /**
  469. * Returns true if offset exists. False otherwise.
  470. *
  471. * @param integer|string $offset Offset
  472. *
  473. * @return boolean
  474. */
  475. public function offsetExists(mixed $offset): bool
  476. {
  477. return isset($this->container[$offset]);
  478. }
  479. /**
  480. * Gets offset.
  481. *
  482. * @param integer|string $offset Offset
  483. *
  484. * @return mixed|null
  485. */
  486. #[\ReturnTypeWillChange]
  487. public function offsetGet(mixed $offset)
  488. {
  489. return $this->container[$offset] ?? null;
  490. }
  491. /**
  492. * Sets value based on offset.
  493. *
  494. * @param int|null $offset Offset
  495. * @param mixed $value Value to be set
  496. *
  497. * @return void
  498. */
  499. public function offsetSet($offset, $value): void
  500. {
  501. if (is_null($offset)) {
  502. $this->container[] = $value;
  503. } else {
  504. $this->container[$offset] = $value;
  505. }
  506. }
  507. /**
  508. * Unsets offset.
  509. *
  510. * @param integer|string $offset Offset
  511. *
  512. * @return void
  513. */
  514. public function offsetUnset(mixed $offset): void
  515. {
  516. unset($this->container[$offset]);
  517. }
  518. /**
  519. * Serializes the object to a value that can be serialized natively by json_encode().
  520. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  521. *
  522. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  523. * of any type other than a resource.
  524. */
  525. #[\ReturnTypeWillChange]
  526. public function jsonSerialize()
  527. {
  528. return ObjectSerializer::sanitizeForSerialization($this);
  529. }
  530. /**
  531. * Gets the string presentation of the object
  532. *
  533. * @return string
  534. */
  535. public function __toString()
  536. {
  537. return json_encode(
  538. ObjectSerializer::sanitizeForSerialization($this),
  539. JSON_PRETTY_PRINT
  540. );
  541. }
  542. /**
  543. * Gets a header-safe presentation of the object
  544. *
  545. * @return string
  546. */
  547. public function toHeaderValue()
  548. {
  549. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  550. }
  551. }