GetApiV3TipitakaReadingChannel200ResponseDataInner.php 11 KB

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