PostApiV3MeReactions200Response.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <?php
  2. /**
  3. * PostApiV3MeReactions200Response
  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. * PostApiV3MeReactions200Response 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 PostApiV3MeReactions200Response 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_me_reactions_200_response';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'data' => '\WikipaliApi\Model\GetApiV3MeReactions200ResponseDataInner'
  54. ];
  55. /**
  56. * Array of property to format mappings. Used for (de)serialization
  57. *
  58. * @var string[]
  59. * @phpstan-var array<string, string|null>
  60. * @psalm-var array<string, string|null>
  61. */
  62. protected static $openAPIFormats = [
  63. 'data' => null
  64. ];
  65. /**
  66. * Array of nullable properties. Used for (de)serialization
  67. *
  68. * @var boolean[]
  69. */
  70. protected static array $openAPINullables = [
  71. 'data' => false
  72. ];
  73. /**
  74. * If a nullable field gets set to null, insert it here
  75. *
  76. * @var boolean[]
  77. */
  78. protected array $openAPINullablesSetToNull = [];
  79. /**
  80. * Array of property to type mappings. Used for (de)serialization
  81. *
  82. * @return array
  83. */
  84. public static function openAPITypes()
  85. {
  86. return self::$openAPITypes;
  87. }
  88. /**
  89. * Array of property to format mappings. Used for (de)serialization
  90. *
  91. * @return array
  92. */
  93. public static function openAPIFormats()
  94. {
  95. return self::$openAPIFormats;
  96. }
  97. /**
  98. * Array of nullable properties
  99. *
  100. * @return array
  101. */
  102. protected static function openAPINullables(): array
  103. {
  104. return self::$openAPINullables;
  105. }
  106. /**
  107. * Array of nullable field names deliberately set to null
  108. *
  109. * @return boolean[]
  110. */
  111. private function getOpenAPINullablesSetToNull(): array
  112. {
  113. return $this->openAPINullablesSetToNull;
  114. }
  115. /**
  116. * Setter - Array of nullable field names deliberately set to null
  117. *
  118. * @param boolean[] $openAPINullablesSetToNull
  119. */
  120. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  121. {
  122. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  123. }
  124. /**
  125. * Checks if a property is nullable
  126. *
  127. * @param string $property
  128. * @return bool
  129. */
  130. public static function isNullable(string $property): bool
  131. {
  132. return self::openAPINullables()[$property] ?? false;
  133. }
  134. /**
  135. * Checks if a nullable property is set to null.
  136. *
  137. * @param string $property
  138. * @return bool
  139. */
  140. public function isNullableSetToNull(string $property): bool
  141. {
  142. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  143. }
  144. /**
  145. * Array of attributes where the key is the local name,
  146. * and the value is the original name
  147. *
  148. * @var string[]
  149. */
  150. protected static $attributeMap = [
  151. 'data' => 'data'
  152. ];
  153. /**
  154. * Array of attributes to setter functions (for deserialization of responses)
  155. *
  156. * @var string[]
  157. */
  158. protected static $setters = [
  159. 'data' => 'setData'
  160. ];
  161. /**
  162. * Array of attributes to getter functions (for serialization of requests)
  163. *
  164. * @var string[]
  165. */
  166. protected static $getters = [
  167. 'data' => 'getData'
  168. ];
  169. /**
  170. * Array of attributes where the key is the local name,
  171. * and the value is the original name
  172. *
  173. * @return array
  174. */
  175. public static function attributeMap()
  176. {
  177. return self::$attributeMap;
  178. }
  179. /**
  180. * Array of attributes to setter functions (for deserialization of responses)
  181. *
  182. * @return array
  183. */
  184. public static function setters()
  185. {
  186. return self::$setters;
  187. }
  188. /**
  189. * Array of attributes to getter functions (for serialization of requests)
  190. *
  191. * @return array
  192. */
  193. public static function getters()
  194. {
  195. return self::$getters;
  196. }
  197. /**
  198. * The original name of the model.
  199. *
  200. * @return string
  201. */
  202. public function getModelName()
  203. {
  204. return self::$openAPIModelName;
  205. }
  206. /**
  207. * Associative array for storing property values
  208. *
  209. * @var mixed[]
  210. */
  211. protected $container = [];
  212. /**
  213. * Constructor
  214. *
  215. * @param mixed[]|null $data Associated array of property values
  216. * initializing the model
  217. */
  218. public function __construct(?array $data = null)
  219. {
  220. $this->setIfExists('data', $data ?? [], null);
  221. }
  222. /**
  223. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  224. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  225. * $this->openAPINullablesSetToNull array
  226. *
  227. * @param string $variableName
  228. * @param array $fields
  229. * @param mixed $defaultValue
  230. */
  231. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  232. {
  233. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  234. $this->openAPINullablesSetToNull[] = $variableName;
  235. }
  236. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  237. }
  238. /**
  239. * Show all the invalid properties with reasons.
  240. *
  241. * @return array invalid properties with reasons
  242. */
  243. public function listInvalidProperties()
  244. {
  245. $invalidProperties = [];
  246. return $invalidProperties;
  247. }
  248. /**
  249. * Validate all the properties in the model
  250. * return true if all passed
  251. *
  252. * @return bool True if all properties are valid
  253. */
  254. public function valid()
  255. {
  256. return count($this->listInvalidProperties()) === 0;
  257. }
  258. /**
  259. * Gets data
  260. *
  261. * @return \WikipaliApi\Model\GetApiV3MeReactions200ResponseDataInner|null
  262. */
  263. public function getData()
  264. {
  265. return $this->container['data'];
  266. }
  267. /**
  268. * Sets data
  269. *
  270. * @param \WikipaliApi\Model\GetApiV3MeReactions200ResponseDataInner|null $data data
  271. *
  272. * @return self
  273. */
  274. public function setData($data)
  275. {
  276. if (is_null($data)) {
  277. throw new \InvalidArgumentException('non-nullable data cannot be null');
  278. }
  279. $this->container['data'] = $data;
  280. return $this;
  281. }
  282. /**
  283. * Returns true if offset exists. False otherwise.
  284. *
  285. * @param integer|string $offset Offset
  286. *
  287. * @return boolean
  288. */
  289. public function offsetExists(mixed $offset): bool
  290. {
  291. return isset($this->container[$offset]);
  292. }
  293. /**
  294. * Gets offset.
  295. *
  296. * @param integer|string $offset Offset
  297. *
  298. * @return mixed|null
  299. */
  300. #[\ReturnTypeWillChange]
  301. public function offsetGet(mixed $offset)
  302. {
  303. return $this->container[$offset] ?? null;
  304. }
  305. /**
  306. * Sets value based on offset.
  307. *
  308. * @param int|null $offset Offset
  309. * @param mixed $value Value to be set
  310. *
  311. * @return void
  312. */
  313. public function offsetSet($offset, $value): void
  314. {
  315. if (is_null($offset)) {
  316. $this->container[] = $value;
  317. } else {
  318. $this->container[$offset] = $value;
  319. }
  320. }
  321. /**
  322. * Unsets offset.
  323. *
  324. * @param integer|string $offset Offset
  325. *
  326. * @return void
  327. */
  328. public function offsetUnset(mixed $offset): void
  329. {
  330. unset($this->container[$offset]);
  331. }
  332. /**
  333. * Serializes the object to a value that can be serialized natively by json_encode().
  334. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  335. *
  336. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  337. * of any type other than a resource.
  338. */
  339. #[\ReturnTypeWillChange]
  340. public function jsonSerialize()
  341. {
  342. return ObjectSerializer::sanitizeForSerialization($this);
  343. }
  344. /**
  345. * Gets the string presentation of the object
  346. *
  347. * @return string
  348. */
  349. public function __toString()
  350. {
  351. return json_encode(
  352. ObjectSerializer::sanitizeForSerialization($this),
  353. JSON_PRETTY_PRINT
  354. );
  355. }
  356. /**
  357. * Gets a header-safe presentation of the object
  358. *
  359. * @return string
  360. */
  361. public function toHeaderValue()
  362. {
  363. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  364. }
  365. }