GetApiV3TipitakaChapters200ResponseDataInner.php 19 KB

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