GetApiV3TipitakaChannels200ResponseDataInner.php 20 KB

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