GetApiV3TipitakaPageNumbersPage200ResponseDataInner.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <?php
  2. /**
  3. * GetApiV3TipitakaPageNumbersPage200ResponseDataInner
  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: 1.0.0
  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. * GetApiV3TipitakaPageNumbersPage200ResponseDataInner 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 GetApiV3TipitakaPageNumbersPage200ResponseDataInner 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_page_numbers_page__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. 'edition' => 'string',
  54. 'volume' => 'int',
  55. 'page' => 'int',
  56. 'book' => 'int',
  57. 'para' => 'int',
  58. 'book_id' => 'int',
  59. 'book_title' => 'string',
  60. 'book_para' => 'int',
  61. 'edition_title' => 'string',
  62. 'layer' => 'string',
  63. 'tags' => 'string[]'
  64. ];
  65. /**
  66. * Array of property to format mappings. Used for (de)serialization
  67. *
  68. * @var string[]
  69. * @phpstan-var array<string, string|null>
  70. * @psalm-var array<string, string|null>
  71. */
  72. protected static $openAPIFormats = [
  73. 'edition' => null,
  74. 'volume' => null,
  75. 'page' => null,
  76. 'book' => null,
  77. 'para' => null,
  78. 'book_id' => null,
  79. 'book_title' => null,
  80. 'book_para' => null,
  81. 'edition_title' => null,
  82. 'layer' => null,
  83. 'tags' => null
  84. ];
  85. /**
  86. * Array of nullable properties. Used for (de)serialization
  87. *
  88. * @var boolean[]
  89. */
  90. protected static array $openAPINullables = [
  91. 'edition' => false,
  92. 'volume' => true,
  93. 'page' => false,
  94. 'book' => false,
  95. 'para' => false,
  96. 'book_id' => false,
  97. 'book_title' => false,
  98. 'book_para' => false,
  99. 'edition_title' => true,
  100. 'layer' => true,
  101. 'tags' => false
  102. ];
  103. /**
  104. * If a nullable field gets set to null, insert it here
  105. *
  106. * @var boolean[]
  107. */
  108. protected array $openAPINullablesSetToNull = [];
  109. /**
  110. * Array of property to type mappings. Used for (de)serialization
  111. *
  112. * @return array
  113. */
  114. public static function openAPITypes()
  115. {
  116. return self::$openAPITypes;
  117. }
  118. /**
  119. * Array of property to format mappings. Used for (de)serialization
  120. *
  121. * @return array
  122. */
  123. public static function openAPIFormats()
  124. {
  125. return self::$openAPIFormats;
  126. }
  127. /**
  128. * Array of nullable properties
  129. *
  130. * @return array
  131. */
  132. protected static function openAPINullables(): array
  133. {
  134. return self::$openAPINullables;
  135. }
  136. /**
  137. * Array of nullable field names deliberately set to null
  138. *
  139. * @return boolean[]
  140. */
  141. private function getOpenAPINullablesSetToNull(): array
  142. {
  143. return $this->openAPINullablesSetToNull;
  144. }
  145. /**
  146. * Setter - Array of nullable field names deliberately set to null
  147. *
  148. * @param boolean[] $openAPINullablesSetToNull
  149. */
  150. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  151. {
  152. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  153. }
  154. /**
  155. * Checks if a property is nullable
  156. *
  157. * @param string $property
  158. * @return bool
  159. */
  160. public static function isNullable(string $property): bool
  161. {
  162. return self::openAPINullables()[$property] ?? false;
  163. }
  164. /**
  165. * Checks if a nullable property is set to null.
  166. *
  167. * @param string $property
  168. * @return bool
  169. */
  170. public function isNullableSetToNull(string $property): bool
  171. {
  172. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  173. }
  174. /**
  175. * Array of attributes where the key is the local name,
  176. * and the value is the original name
  177. *
  178. * @var string[]
  179. */
  180. protected static $attributeMap = [
  181. 'edition' => 'edition',
  182. 'volume' => 'volume',
  183. 'page' => 'page',
  184. 'book' => 'book',
  185. 'para' => 'para',
  186. 'book_id' => 'book_id',
  187. 'book_title' => 'book_title',
  188. 'book_para' => 'book_para',
  189. 'edition_title' => 'edition_title',
  190. 'layer' => 'layer',
  191. 'tags' => 'tags'
  192. ];
  193. /**
  194. * Array of attributes to setter functions (for deserialization of responses)
  195. *
  196. * @var string[]
  197. */
  198. protected static $setters = [
  199. 'edition' => 'setEdition',
  200. 'volume' => 'setVolume',
  201. 'page' => 'setPage',
  202. 'book' => 'setBook',
  203. 'para' => 'setPara',
  204. 'book_id' => 'setBookId',
  205. 'book_title' => 'setBookTitle',
  206. 'book_para' => 'setBookPara',
  207. 'edition_title' => 'setEditionTitle',
  208. 'layer' => 'setLayer',
  209. 'tags' => 'setTags'
  210. ];
  211. /**
  212. * Array of attributes to getter functions (for serialization of requests)
  213. *
  214. * @var string[]
  215. */
  216. protected static $getters = [
  217. 'edition' => 'getEdition',
  218. 'volume' => 'getVolume',
  219. 'page' => 'getPage',
  220. 'book' => 'getBook',
  221. 'para' => 'getPara',
  222. 'book_id' => 'getBookId',
  223. 'book_title' => 'getBookTitle',
  224. 'book_para' => 'getBookPara',
  225. 'edition_title' => 'getEditionTitle',
  226. 'layer' => 'getLayer',
  227. 'tags' => 'getTags'
  228. ];
  229. /**
  230. * Array of attributes where the key is the local name,
  231. * and the value is the original name
  232. *
  233. * @return array
  234. */
  235. public static function attributeMap()
  236. {
  237. return self::$attributeMap;
  238. }
  239. /**
  240. * Array of attributes to setter functions (for deserialization of responses)
  241. *
  242. * @return array
  243. */
  244. public static function setters()
  245. {
  246. return self::$setters;
  247. }
  248. /**
  249. * Array of attributes to getter functions (for serialization of requests)
  250. *
  251. * @return array
  252. */
  253. public static function getters()
  254. {
  255. return self::$getters;
  256. }
  257. /**
  258. * The original name of the model.
  259. *
  260. * @return string
  261. */
  262. public function getModelName()
  263. {
  264. return self::$openAPIModelName;
  265. }
  266. /**
  267. * Associative array for storing property values
  268. *
  269. * @var mixed[]
  270. */
  271. protected $container = [];
  272. /**
  273. * Constructor
  274. *
  275. * @param mixed[]|null $data Associated array of property values
  276. * initializing the model
  277. */
  278. public function __construct(?array $data = null)
  279. {
  280. $this->setIfExists('edition', $data ?? [], null);
  281. $this->setIfExists('volume', $data ?? [], null);
  282. $this->setIfExists('page', $data ?? [], null);
  283. $this->setIfExists('book', $data ?? [], null);
  284. $this->setIfExists('para', $data ?? [], null);
  285. $this->setIfExists('book_id', $data ?? [], null);
  286. $this->setIfExists('book_title', $data ?? [], null);
  287. $this->setIfExists('book_para', $data ?? [], null);
  288. $this->setIfExists('edition_title', $data ?? [], null);
  289. $this->setIfExists('layer', $data ?? [], null);
  290. $this->setIfExists('tags', $data ?? [], null);
  291. }
  292. /**
  293. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  294. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  295. * $this->openAPINullablesSetToNull array
  296. *
  297. * @param string $variableName
  298. * @param array $fields
  299. * @param mixed $defaultValue
  300. */
  301. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  302. {
  303. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  304. $this->openAPINullablesSetToNull[] = $variableName;
  305. }
  306. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  307. }
  308. /**
  309. * Show all the invalid properties with reasons.
  310. *
  311. * @return array invalid properties with reasons
  312. */
  313. public function listInvalidProperties()
  314. {
  315. $invalidProperties = [];
  316. return $invalidProperties;
  317. }
  318. /**
  319. * Validate all the properties in the model
  320. * return true if all passed
  321. *
  322. * @return bool True if all properties are valid
  323. */
  324. public function valid()
  325. {
  326. return count($this->listInvalidProperties()) === 0;
  327. }
  328. /**
  329. * Gets edition
  330. *
  331. * @return string|null
  332. */
  333. public function getEdition()
  334. {
  335. return $this->container['edition'];
  336. }
  337. /**
  338. * Sets edition
  339. *
  340. * @param string|null $edition edition
  341. *
  342. * @return self
  343. */
  344. public function setEdition($edition)
  345. {
  346. if (is_null($edition)) {
  347. throw new \InvalidArgumentException('non-nullable edition cannot be null');
  348. }
  349. $this->container['edition'] = $edition;
  350. return $this;
  351. }
  352. /**
  353. * Gets volume
  354. *
  355. * @return int|null
  356. */
  357. public function getVolume()
  358. {
  359. return $this->container['volume'];
  360. }
  361. /**
  362. * Sets volume
  363. *
  364. * @param int|null $volume volume
  365. *
  366. * @return self
  367. */
  368. public function setVolume($volume)
  369. {
  370. if (is_null($volume)) {
  371. array_push($this->openAPINullablesSetToNull, 'volume');
  372. } else {
  373. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  374. $index = array_search('volume', $nullablesSetToNull);
  375. if ($index !== FALSE) {
  376. unset($nullablesSetToNull[$index]);
  377. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  378. }
  379. }
  380. $this->container['volume'] = $volume;
  381. return $this;
  382. }
  383. /**
  384. * Gets page
  385. *
  386. * @return int|null
  387. */
  388. public function getPage()
  389. {
  390. return $this->container['page'];
  391. }
  392. /**
  393. * Sets page
  394. *
  395. * @param int|null $page page
  396. *
  397. * @return self
  398. */
  399. public function setPage($page)
  400. {
  401. if (is_null($page)) {
  402. throw new \InvalidArgumentException('non-nullable page cannot be null');
  403. }
  404. $this->container['page'] = $page;
  405. return $this;
  406. }
  407. /**
  408. * Gets book
  409. *
  410. * @return int|null
  411. */
  412. public function getBook()
  413. {
  414. return $this->container['book'];
  415. }
  416. /**
  417. * Sets book
  418. *
  419. * @param int|null $book book
  420. *
  421. * @return self
  422. */
  423. public function setBook($book)
  424. {
  425. if (is_null($book)) {
  426. throw new \InvalidArgumentException('non-nullable book cannot be null');
  427. }
  428. $this->container['book'] = $book;
  429. return $this;
  430. }
  431. /**
  432. * Gets para
  433. *
  434. * @return int|null
  435. */
  436. public function getPara()
  437. {
  438. return $this->container['para'];
  439. }
  440. /**
  441. * Sets para
  442. *
  443. * @param int|null $para para
  444. *
  445. * @return self
  446. */
  447. public function setPara($para)
  448. {
  449. if (is_null($para)) {
  450. throw new \InvalidArgumentException('non-nullable para cannot be null');
  451. }
  452. $this->container['para'] = $para;
  453. return $this;
  454. }
  455. /**
  456. * Gets book_id
  457. *
  458. * @return int|null
  459. */
  460. public function getBookId()
  461. {
  462. return $this->container['book_id'];
  463. }
  464. /**
  465. * Sets book_id
  466. *
  467. * @param int|null $book_id book_id
  468. *
  469. * @return self
  470. */
  471. public function setBookId($book_id)
  472. {
  473. if (is_null($book_id)) {
  474. throw new \InvalidArgumentException('non-nullable book_id cannot be null');
  475. }
  476. $this->container['book_id'] = $book_id;
  477. return $this;
  478. }
  479. /**
  480. * Gets book_title
  481. *
  482. * @return string|null
  483. */
  484. public function getBookTitle()
  485. {
  486. return $this->container['book_title'];
  487. }
  488. /**
  489. * Sets book_title
  490. *
  491. * @param string|null $book_title book_title
  492. *
  493. * @return self
  494. */
  495. public function setBookTitle($book_title)
  496. {
  497. if (is_null($book_title)) {
  498. throw new \InvalidArgumentException('non-nullable book_title cannot be null');
  499. }
  500. $this->container['book_title'] = $book_title;
  501. return $this;
  502. }
  503. /**
  504. * Gets book_para
  505. *
  506. * @return int|null
  507. */
  508. public function getBookPara()
  509. {
  510. return $this->container['book_para'];
  511. }
  512. /**
  513. * Sets book_para
  514. *
  515. * @param int|null $book_para book_para
  516. *
  517. * @return self
  518. */
  519. public function setBookPara($book_para)
  520. {
  521. if (is_null($book_para)) {
  522. throw new \InvalidArgumentException('non-nullable book_para cannot be null');
  523. }
  524. $this->container['book_para'] = $book_para;
  525. return $this;
  526. }
  527. /**
  528. * Gets edition_title
  529. *
  530. * @return string|null
  531. */
  532. public function getEditionTitle()
  533. {
  534. return $this->container['edition_title'];
  535. }
  536. /**
  537. * Sets edition_title
  538. *
  539. * @param string|null $edition_title edition_title
  540. *
  541. * @return self
  542. */
  543. public function setEditionTitle($edition_title)
  544. {
  545. if (is_null($edition_title)) {
  546. array_push($this->openAPINullablesSetToNull, 'edition_title');
  547. } else {
  548. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  549. $index = array_search('edition_title', $nullablesSetToNull);
  550. if ($index !== FALSE) {
  551. unset($nullablesSetToNull[$index]);
  552. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  553. }
  554. }
  555. $this->container['edition_title'] = $edition_title;
  556. return $this;
  557. }
  558. /**
  559. * Gets layer
  560. *
  561. * @return string|null
  562. */
  563. public function getLayer()
  564. {
  565. return $this->container['layer'];
  566. }
  567. /**
  568. * Sets layer
  569. *
  570. * @param string|null $layer layer
  571. *
  572. * @return self
  573. */
  574. public function setLayer($layer)
  575. {
  576. if (is_null($layer)) {
  577. array_push($this->openAPINullablesSetToNull, 'layer');
  578. } else {
  579. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  580. $index = array_search('layer', $nullablesSetToNull);
  581. if ($index !== FALSE) {
  582. unset($nullablesSetToNull[$index]);
  583. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  584. }
  585. }
  586. $this->container['layer'] = $layer;
  587. return $this;
  588. }
  589. /**
  590. * Gets tags
  591. *
  592. * @return string[]|null
  593. */
  594. public function getTags()
  595. {
  596. return $this->container['tags'];
  597. }
  598. /**
  599. * Sets tags
  600. *
  601. * @param string[]|null $tags tags
  602. *
  603. * @return self
  604. */
  605. public function setTags($tags)
  606. {
  607. if (is_null($tags)) {
  608. throw new \InvalidArgumentException('non-nullable tags cannot be null');
  609. }
  610. $this->container['tags'] = $tags;
  611. return $this;
  612. }
  613. /**
  614. * Returns true if offset exists. False otherwise.
  615. *
  616. * @param integer|string $offset Offset
  617. *
  618. * @return boolean
  619. */
  620. public function offsetExists(mixed $offset): bool
  621. {
  622. return isset($this->container[$offset]);
  623. }
  624. /**
  625. * Gets offset.
  626. *
  627. * @param integer|string $offset Offset
  628. *
  629. * @return mixed|null
  630. */
  631. #[\ReturnTypeWillChange]
  632. public function offsetGet(mixed $offset)
  633. {
  634. return $this->container[$offset] ?? null;
  635. }
  636. /**
  637. * Sets value based on offset.
  638. *
  639. * @param int|null $offset Offset
  640. * @param mixed $value Value to be set
  641. *
  642. * @return void
  643. */
  644. public function offsetSet($offset, $value): void
  645. {
  646. if (is_null($offset)) {
  647. $this->container[] = $value;
  648. } else {
  649. $this->container[$offset] = $value;
  650. }
  651. }
  652. /**
  653. * Unsets offset.
  654. *
  655. * @param integer|string $offset Offset
  656. *
  657. * @return void
  658. */
  659. public function offsetUnset(mixed $offset): void
  660. {
  661. unset($this->container[$offset]);
  662. }
  663. /**
  664. * Serializes the object to a value that can be serialized natively by json_encode().
  665. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  666. *
  667. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  668. * of any type other than a resource.
  669. */
  670. #[\ReturnTypeWillChange]
  671. public function jsonSerialize()
  672. {
  673. return ObjectSerializer::sanitizeForSerialization($this);
  674. }
  675. /**
  676. * Gets the string presentation of the object
  677. *
  678. * @return string
  679. */
  680. public function __toString()
  681. {
  682. return json_encode(
  683. ObjectSerializer::sanitizeForSerialization($this),
  684. JSON_PRETTY_PRINT
  685. );
  686. }
  687. /**
  688. * Gets a header-safe presentation of the object
  689. *
  690. * @return string
  691. */
  692. public function toHeaderValue()
  693. {
  694. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  695. }
  696. }