GetApiV3TipitakaRelatedParagraphs200ResponseDataInner.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. <?php
  2. /**
  3. * GetApiV3TipitakaRelatedParagraphs200ResponseDataInner
  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. * GetApiV3TipitakaRelatedParagraphs200ResponseDataInner 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 GetApiV3TipitakaRelatedParagraphs200ResponseDataInner 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_related_paragraphs_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. 'book' => 'int',
  54. 'book_id' => 'int',
  55. 'title' => 'string',
  56. 'cs_para' => 'int',
  57. 'para' => 'int[]',
  58. 'tags' => 'string[]',
  59. 'path' => '\WikipaliApi\Model\GetApiV3TipitakaRelatedParagraphs200ResponseDataInnerPathInner[]'
  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. 'book' => null,
  70. 'book_id' => null,
  71. 'title' => null,
  72. 'cs_para' => null,
  73. 'para' => null,
  74. 'tags' => null,
  75. 'path' => null
  76. ];
  77. /**
  78. * Array of nullable properties. Used for (de)serialization
  79. *
  80. * @var boolean[]
  81. */
  82. protected static array $openAPINullables = [
  83. 'book' => false,
  84. 'book_id' => false,
  85. 'title' => true,
  86. 'cs_para' => false,
  87. 'para' => false,
  88. 'tags' => false,
  89. 'path' => true
  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. 'book' => 'book',
  170. 'book_id' => 'book_id',
  171. 'title' => 'title',
  172. 'cs_para' => 'cs_para',
  173. 'para' => 'para',
  174. 'tags' => 'tags',
  175. 'path' => 'path'
  176. ];
  177. /**
  178. * Array of attributes to setter functions (for deserialization of responses)
  179. *
  180. * @var string[]
  181. */
  182. protected static $setters = [
  183. 'book' => 'setBook',
  184. 'book_id' => 'setBookId',
  185. 'title' => 'setTitle',
  186. 'cs_para' => 'setCsPara',
  187. 'para' => 'setPara',
  188. 'tags' => 'setTags',
  189. 'path' => 'setPath'
  190. ];
  191. /**
  192. * Array of attributes to getter functions (for serialization of requests)
  193. *
  194. * @var string[]
  195. */
  196. protected static $getters = [
  197. 'book' => 'getBook',
  198. 'book_id' => 'getBookId',
  199. 'title' => 'getTitle',
  200. 'cs_para' => 'getCsPara',
  201. 'para' => 'getPara',
  202. 'tags' => 'getTags',
  203. 'path' => 'getPath'
  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('book', $data ?? [], null);
  257. $this->setIfExists('book_id', $data ?? [], null);
  258. $this->setIfExists('title', $data ?? [], null);
  259. $this->setIfExists('cs_para', $data ?? [], null);
  260. $this->setIfExists('para', $data ?? [], null);
  261. $this->setIfExists('tags', $data ?? [], null);
  262. $this->setIfExists('path', $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 book
  302. *
  303. * @return int|null
  304. */
  305. public function getBook()
  306. {
  307. return $this->container['book'];
  308. }
  309. /**
  310. * Sets book
  311. *
  312. * @param int|null $book book
  313. *
  314. * @return self
  315. */
  316. public function setBook($book)
  317. {
  318. if (is_null($book)) {
  319. throw new \InvalidArgumentException('non-nullable book cannot be null');
  320. }
  321. $this->container['book'] = $book;
  322. return $this;
  323. }
  324. /**
  325. * Gets book_id
  326. *
  327. * @return int|null
  328. */
  329. public function getBookId()
  330. {
  331. return $this->container['book_id'];
  332. }
  333. /**
  334. * Sets book_id
  335. *
  336. * @param int|null $book_id book_id
  337. *
  338. * @return self
  339. */
  340. public function setBookId($book_id)
  341. {
  342. if (is_null($book_id)) {
  343. throw new \InvalidArgumentException('non-nullable book_id cannot be null');
  344. }
  345. $this->container['book_id'] = $book_id;
  346. return $this;
  347. }
  348. /**
  349. * Gets title
  350. *
  351. * @return string|null
  352. */
  353. public function getTitle()
  354. {
  355. return $this->container['title'];
  356. }
  357. /**
  358. * Sets title
  359. *
  360. * @param string|null $title title
  361. *
  362. * @return self
  363. */
  364. public function setTitle($title)
  365. {
  366. if (is_null($title)) {
  367. array_push($this->openAPINullablesSetToNull, 'title');
  368. } else {
  369. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  370. $index = array_search('title', $nullablesSetToNull);
  371. if ($index !== FALSE) {
  372. unset($nullablesSetToNull[$index]);
  373. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  374. }
  375. }
  376. $this->container['title'] = $title;
  377. return $this;
  378. }
  379. /**
  380. * Gets cs_para
  381. *
  382. * @return int|null
  383. */
  384. public function getCsPara()
  385. {
  386. return $this->container['cs_para'];
  387. }
  388. /**
  389. * Sets cs_para
  390. *
  391. * @param int|null $cs_para cs_para
  392. *
  393. * @return self
  394. */
  395. public function setCsPara($cs_para)
  396. {
  397. if (is_null($cs_para)) {
  398. throw new \InvalidArgumentException('non-nullable cs_para cannot be null');
  399. }
  400. $this->container['cs_para'] = $cs_para;
  401. return $this;
  402. }
  403. /**
  404. * Gets para
  405. *
  406. * @return int[]|null
  407. */
  408. public function getPara()
  409. {
  410. return $this->container['para'];
  411. }
  412. /**
  413. * Sets para
  414. *
  415. * @param int[]|null $para para
  416. *
  417. * @return self
  418. */
  419. public function setPara($para)
  420. {
  421. if (is_null($para)) {
  422. throw new \InvalidArgumentException('non-nullable para cannot be null');
  423. }
  424. $this->container['para'] = $para;
  425. return $this;
  426. }
  427. /**
  428. * Gets tags
  429. *
  430. * @return string[]|null
  431. */
  432. public function getTags()
  433. {
  434. return $this->container['tags'];
  435. }
  436. /**
  437. * Sets tags
  438. *
  439. * @param string[]|null $tags tags
  440. *
  441. * @return self
  442. */
  443. public function setTags($tags)
  444. {
  445. if (is_null($tags)) {
  446. throw new \InvalidArgumentException('non-nullable tags cannot be null');
  447. }
  448. $this->container['tags'] = $tags;
  449. return $this;
  450. }
  451. /**
  452. * Gets path
  453. *
  454. * @return \WikipaliApi\Model\GetApiV3TipitakaRelatedParagraphs200ResponseDataInnerPathInner[]|null
  455. */
  456. public function getPath()
  457. {
  458. return $this->container['path'];
  459. }
  460. /**
  461. * Sets path
  462. *
  463. * @param \WikipaliApi\Model\GetApiV3TipitakaRelatedParagraphs200ResponseDataInnerPathInner[]|null $path path
  464. *
  465. * @return self
  466. */
  467. public function setPath($path)
  468. {
  469. if (is_null($path)) {
  470. array_push($this->openAPINullablesSetToNull, 'path');
  471. } else {
  472. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  473. $index = array_search('path', $nullablesSetToNull);
  474. if ($index !== FALSE) {
  475. unset($nullablesSetToNull[$index]);
  476. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  477. }
  478. }
  479. $this->container['path'] = $path;
  480. return $this;
  481. }
  482. /**
  483. * Returns true if offset exists. False otherwise.
  484. *
  485. * @param integer|string $offset Offset
  486. *
  487. * @return boolean
  488. */
  489. public function offsetExists(mixed $offset): bool
  490. {
  491. return isset($this->container[$offset]);
  492. }
  493. /**
  494. * Gets offset.
  495. *
  496. * @param integer|string $offset Offset
  497. *
  498. * @return mixed|null
  499. */
  500. #[\ReturnTypeWillChange]
  501. public function offsetGet(mixed $offset)
  502. {
  503. return $this->container[$offset] ?? null;
  504. }
  505. /**
  506. * Sets value based on offset.
  507. *
  508. * @param int|null $offset Offset
  509. * @param mixed $value Value to be set
  510. *
  511. * @return void
  512. */
  513. public function offsetSet($offset, $value): void
  514. {
  515. if (is_null($offset)) {
  516. $this->container[] = $value;
  517. } else {
  518. $this->container[$offset] = $value;
  519. }
  520. }
  521. /**
  522. * Unsets offset.
  523. *
  524. * @param integer|string $offset Offset
  525. *
  526. * @return void
  527. */
  528. public function offsetUnset(mixed $offset): void
  529. {
  530. unset($this->container[$offset]);
  531. }
  532. /**
  533. * Serializes the object to a value that can be serialized natively by json_encode().
  534. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  535. *
  536. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  537. * of any type other than a resource.
  538. */
  539. #[\ReturnTypeWillChange]
  540. public function jsonSerialize()
  541. {
  542. return ObjectSerializer::sanitizeForSerialization($this);
  543. }
  544. /**
  545. * Gets the string presentation of the object
  546. *
  547. * @return string
  548. */
  549. public function __toString()
  550. {
  551. return json_encode(
  552. ObjectSerializer::sanitizeForSerialization($this),
  553. JSON_PRETTY_PRINT
  554. );
  555. }
  556. /**
  557. * Gets a header-safe presentation of the object
  558. *
  559. * @return string
  560. */
  561. public function toHeaderValue()
  562. {
  563. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  564. }
  565. }