BoxOfficeParams.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Models\DTO\Movie;
  3. use JsonSerializable;
  4. class BoxOfficeParams implements JsonSerializable
  5. {
  6. public string $key;
  7. public function __construct(
  8. public string $targetDt = "",
  9. public string|null $weekGb = null,
  10. public string|null $itemPerPage = null,
  11. public string|null $multiMovieYn = null,
  12. public string|null $repNationCd = null,
  13. public string|null $wideAreaCd = null
  14. ) {
  15. $this->key = KOBIS_API_1;
  16. $this->weekGb = "0";
  17. $this->itemPerPage = "10";
  18. }
  19. public function jsonSerialize(): array
  20. {
  21. return [
  22. 'targetDt' => $this->targetDt,
  23. 'weekGb' => $this->weekGb,
  24. 'itemPerPage' => $this->itemPerPage,
  25. 'multiMovieYn' => $this->multiMovieYn,
  26. 'repNationCd' => $this->repNationCd,
  27. 'wideAreaCd' => $this->wideAreaCd
  28. ];
  29. }
  30. public function toArray(): array
  31. {
  32. return [
  33. 'key' => $this->key,
  34. 'targetDt' => $this->targetDt,
  35. 'weekGb' => $this->weekGb,
  36. 'itemPerPage' => $this->itemPerPage,
  37. 'multiMovieYn' => $this->multiMovieYn,
  38. 'repNationCd' => $this->repNationCd,
  39. 'wideAreaCd' => $this->wideAreaCd
  40. ];
  41. }
  42. public function toJson(): string|false
  43. {
  44. return json_encode([
  45. 'targetDt' => $this->targetDt,
  46. 'weekGb' => $this->weekGb,
  47. 'itemPerPage' => $this->itemPerPage,
  48. 'multiMovieYn' => $this->multiMovieYn,
  49. 'repNationCd' => $this->repNationCd,
  50. 'wideAreaCd' => $this->wideAreaCd
  51. ]);
  52. }
  53. }