CompanyParams.php 1.5 KB

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