GetApiV3AdminReadingStats200ResponseData.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. <?php
  2. /**
  3. * GetApiV3AdminReadingStats200ResponseData
  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.11.12
  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. * GetApiV3AdminReadingStats200ResponseData 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 GetApiV3AdminReadingStats200ResponseData 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_admin_reading_stats_200_response_data';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'range' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataRange',
  54. 'summary' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSummary',
  55. 'previous' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSummary',
  56. 'sticky' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSticky',
  57. 'daily' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataDailyInner[]',
  58. 'top_chapters' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataTopChaptersInner[]',
  59. 'pitaka_share' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataPitakaShareInner[]',
  60. 'layer_share' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataPitakaShareInner[]',
  61. 'duration_buckets' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataDurationBucketsInner[]',
  62. 'reading_credits' => '\WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataReadingCredits'
  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. 'range' => null,
  73. 'summary' => null,
  74. 'previous' => null,
  75. 'sticky' => null,
  76. 'daily' => null,
  77. 'top_chapters' => null,
  78. 'pitaka_share' => null,
  79. 'layer_share' => null,
  80. 'duration_buckets' => null,
  81. 'reading_credits' => null
  82. ];
  83. /**
  84. * Array of nullable properties. Used for (de)serialization
  85. *
  86. * @var boolean[]
  87. */
  88. protected static array $openAPINullables = [
  89. 'range' => false,
  90. 'summary' => false,
  91. 'previous' => false,
  92. 'sticky' => false,
  93. 'daily' => false,
  94. 'top_chapters' => false,
  95. 'pitaka_share' => false,
  96. 'layer_share' => false,
  97. 'duration_buckets' => false,
  98. 'reading_credits' => true
  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. 'range' => 'range',
  179. 'summary' => 'summary',
  180. 'previous' => 'previous',
  181. 'sticky' => 'sticky',
  182. 'daily' => 'daily',
  183. 'top_chapters' => 'top_chapters',
  184. 'pitaka_share' => 'pitaka_share',
  185. 'layer_share' => 'layer_share',
  186. 'duration_buckets' => 'duration_buckets',
  187. 'reading_credits' => 'reading_credits'
  188. ];
  189. /**
  190. * Array of attributes to setter functions (for deserialization of responses)
  191. *
  192. * @var string[]
  193. */
  194. protected static $setters = [
  195. 'range' => 'setRange',
  196. 'summary' => 'setSummary',
  197. 'previous' => 'setPrevious',
  198. 'sticky' => 'setSticky',
  199. 'daily' => 'setDaily',
  200. 'top_chapters' => 'setTopChapters',
  201. 'pitaka_share' => 'setPitakaShare',
  202. 'layer_share' => 'setLayerShare',
  203. 'duration_buckets' => 'setDurationBuckets',
  204. 'reading_credits' => 'setReadingCredits'
  205. ];
  206. /**
  207. * Array of attributes to getter functions (for serialization of requests)
  208. *
  209. * @var string[]
  210. */
  211. protected static $getters = [
  212. 'range' => 'getRange',
  213. 'summary' => 'getSummary',
  214. 'previous' => 'getPrevious',
  215. 'sticky' => 'getSticky',
  216. 'daily' => 'getDaily',
  217. 'top_chapters' => 'getTopChapters',
  218. 'pitaka_share' => 'getPitakaShare',
  219. 'layer_share' => 'getLayerShare',
  220. 'duration_buckets' => 'getDurationBuckets',
  221. 'reading_credits' => 'getReadingCredits'
  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('range', $data ?? [], null);
  275. $this->setIfExists('summary', $data ?? [], null);
  276. $this->setIfExists('previous', $data ?? [], null);
  277. $this->setIfExists('sticky', $data ?? [], null);
  278. $this->setIfExists('daily', $data ?? [], null);
  279. $this->setIfExists('top_chapters', $data ?? [], null);
  280. $this->setIfExists('pitaka_share', $data ?? [], null);
  281. $this->setIfExists('layer_share', $data ?? [], null);
  282. $this->setIfExists('duration_buckets', $data ?? [], null);
  283. $this->setIfExists('reading_credits', $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 range
  323. *
  324. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataRange|null
  325. */
  326. public function getRange()
  327. {
  328. return $this->container['range'];
  329. }
  330. /**
  331. * Sets range
  332. *
  333. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataRange|null $range range
  334. *
  335. * @return self
  336. */
  337. public function setRange($range)
  338. {
  339. if (is_null($range)) {
  340. throw new \InvalidArgumentException('non-nullable range cannot be null');
  341. }
  342. $this->container['range'] = $range;
  343. return $this;
  344. }
  345. /**
  346. * Gets summary
  347. *
  348. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSummary|null
  349. */
  350. public function getSummary()
  351. {
  352. return $this->container['summary'];
  353. }
  354. /**
  355. * Sets summary
  356. *
  357. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSummary|null $summary summary
  358. *
  359. * @return self
  360. */
  361. public function setSummary($summary)
  362. {
  363. if (is_null($summary)) {
  364. throw new \InvalidArgumentException('non-nullable summary cannot be null');
  365. }
  366. $this->container['summary'] = $summary;
  367. return $this;
  368. }
  369. /**
  370. * Gets previous
  371. *
  372. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSummary|null
  373. */
  374. public function getPrevious()
  375. {
  376. return $this->container['previous'];
  377. }
  378. /**
  379. * Sets previous
  380. *
  381. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSummary|null $previous previous
  382. *
  383. * @return self
  384. */
  385. public function setPrevious($previous)
  386. {
  387. if (is_null($previous)) {
  388. throw new \InvalidArgumentException('non-nullable previous cannot be null');
  389. }
  390. $this->container['previous'] = $previous;
  391. return $this;
  392. }
  393. /**
  394. * Gets sticky
  395. *
  396. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSticky|null
  397. */
  398. public function getSticky()
  399. {
  400. return $this->container['sticky'];
  401. }
  402. /**
  403. * Sets sticky
  404. *
  405. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataSticky|null $sticky sticky
  406. *
  407. * @return self
  408. */
  409. public function setSticky($sticky)
  410. {
  411. if (is_null($sticky)) {
  412. throw new \InvalidArgumentException('non-nullable sticky cannot be null');
  413. }
  414. $this->container['sticky'] = $sticky;
  415. return $this;
  416. }
  417. /**
  418. * Gets daily
  419. *
  420. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataDailyInner[]|null
  421. */
  422. public function getDaily()
  423. {
  424. return $this->container['daily'];
  425. }
  426. /**
  427. * Sets daily
  428. *
  429. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataDailyInner[]|null $daily daily
  430. *
  431. * @return self
  432. */
  433. public function setDaily($daily)
  434. {
  435. if (is_null($daily)) {
  436. throw new \InvalidArgumentException('non-nullable daily cannot be null');
  437. }
  438. $this->container['daily'] = $daily;
  439. return $this;
  440. }
  441. /**
  442. * Gets top_chapters
  443. *
  444. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataTopChaptersInner[]|null
  445. */
  446. public function getTopChapters()
  447. {
  448. return $this->container['top_chapters'];
  449. }
  450. /**
  451. * Sets top_chapters
  452. *
  453. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataTopChaptersInner[]|null $top_chapters top_chapters
  454. *
  455. * @return self
  456. */
  457. public function setTopChapters($top_chapters)
  458. {
  459. if (is_null($top_chapters)) {
  460. throw new \InvalidArgumentException('non-nullable top_chapters cannot be null');
  461. }
  462. $this->container['top_chapters'] = $top_chapters;
  463. return $this;
  464. }
  465. /**
  466. * Gets pitaka_share
  467. *
  468. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataPitakaShareInner[]|null
  469. */
  470. public function getPitakaShare()
  471. {
  472. return $this->container['pitaka_share'];
  473. }
  474. /**
  475. * Sets pitaka_share
  476. *
  477. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataPitakaShareInner[]|null $pitaka_share pitaka_share
  478. *
  479. * @return self
  480. */
  481. public function setPitakaShare($pitaka_share)
  482. {
  483. if (is_null($pitaka_share)) {
  484. throw new \InvalidArgumentException('non-nullable pitaka_share cannot be null');
  485. }
  486. $this->container['pitaka_share'] = $pitaka_share;
  487. return $this;
  488. }
  489. /**
  490. * Gets layer_share
  491. *
  492. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataPitakaShareInner[]|null
  493. */
  494. public function getLayerShare()
  495. {
  496. return $this->container['layer_share'];
  497. }
  498. /**
  499. * Sets layer_share
  500. *
  501. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataPitakaShareInner[]|null $layer_share layer_share
  502. *
  503. * @return self
  504. */
  505. public function setLayerShare($layer_share)
  506. {
  507. if (is_null($layer_share)) {
  508. throw new \InvalidArgumentException('non-nullable layer_share cannot be null');
  509. }
  510. $this->container['layer_share'] = $layer_share;
  511. return $this;
  512. }
  513. /**
  514. * Gets duration_buckets
  515. *
  516. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataDurationBucketsInner[]|null
  517. */
  518. public function getDurationBuckets()
  519. {
  520. return $this->container['duration_buckets'];
  521. }
  522. /**
  523. * Sets duration_buckets
  524. *
  525. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataDurationBucketsInner[]|null $duration_buckets duration_buckets
  526. *
  527. * @return self
  528. */
  529. public function setDurationBuckets($duration_buckets)
  530. {
  531. if (is_null($duration_buckets)) {
  532. throw new \InvalidArgumentException('non-nullable duration_buckets cannot be null');
  533. }
  534. $this->container['duration_buckets'] = $duration_buckets;
  535. return $this;
  536. }
  537. /**
  538. * Gets reading_credits
  539. *
  540. * @return \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataReadingCredits|null
  541. */
  542. public function getReadingCredits()
  543. {
  544. return $this->container['reading_credits'];
  545. }
  546. /**
  547. * Sets reading_credits
  548. *
  549. * @param \WikipaliApi\Model\GetApiV3AdminReadingStats200ResponseDataReadingCredits|null $reading_credits reading_credits
  550. *
  551. * @return self
  552. */
  553. public function setReadingCredits($reading_credits)
  554. {
  555. if (is_null($reading_credits)) {
  556. array_push($this->openAPINullablesSetToNull, 'reading_credits');
  557. } else {
  558. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  559. $index = array_search('reading_credits', $nullablesSetToNull);
  560. if ($index !== FALSE) {
  561. unset($nullablesSetToNull[$index]);
  562. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  563. }
  564. }
  565. $this->container['reading_credits'] = $reading_credits;
  566. return $this;
  567. }
  568. /**
  569. * Returns true if offset exists. False otherwise.
  570. *
  571. * @param integer|string $offset Offset
  572. *
  573. * @return boolean
  574. */
  575. public function offsetExists(mixed $offset): bool
  576. {
  577. return isset($this->container[$offset]);
  578. }
  579. /**
  580. * Gets offset.
  581. *
  582. * @param integer|string $offset Offset
  583. *
  584. * @return mixed|null
  585. */
  586. #[\ReturnTypeWillChange]
  587. public function offsetGet(mixed $offset)
  588. {
  589. return $this->container[$offset] ?? null;
  590. }
  591. /**
  592. * Sets value based on offset.
  593. *
  594. * @param int|null $offset Offset
  595. * @param mixed $value Value to be set
  596. *
  597. * @return void
  598. */
  599. public function offsetSet($offset, $value): void
  600. {
  601. if (is_null($offset)) {
  602. $this->container[] = $value;
  603. } else {
  604. $this->container[$offset] = $value;
  605. }
  606. }
  607. /**
  608. * Unsets offset.
  609. *
  610. * @param integer|string $offset Offset
  611. *
  612. * @return void
  613. */
  614. public function offsetUnset(mixed $offset): void
  615. {
  616. unset($this->container[$offset]);
  617. }
  618. /**
  619. * Serializes the object to a value that can be serialized natively by json_encode().
  620. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  621. *
  622. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  623. * of any type other than a resource.
  624. */
  625. #[\ReturnTypeWillChange]
  626. public function jsonSerialize()
  627. {
  628. return ObjectSerializer::sanitizeForSerialization($this);
  629. }
  630. /**
  631. * Gets the string presentation of the object
  632. *
  633. * @return string
  634. */
  635. public function __toString()
  636. {
  637. return json_encode(
  638. ObjectSerializer::sanitizeForSerialization($this),
  639. JSON_PRETTY_PRINT
  640. );
  641. }
  642. /**
  643. * Gets a header-safe presentation of the object
  644. *
  645. * @return string
  646. */
  647. public function toHeaderValue()
  648. {
  649. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  650. }
  651. }