GetApiV3TipitakaWordParagraphs200ResponseDataInner.php 16 KB

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