Article.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace internship\bo;
  3. use n2n\reflection\ObjectAdapter;
  4. class Article extends ObjectAdapter implements \JsonSerializable {
  5. private int $id;
  6. private string $categoryName;
  7. private string $text;
  8. private string $title;
  9. /**
  10. * @return int
  11. */
  12. public function getId(): int {
  13. return $this->id;
  14. }
  15. /**
  16. * @param int $id
  17. */
  18. public function setId(int $id): void {
  19. $this->id = $id;
  20. }
  21. /**
  22. * @return string
  23. */
  24. public function getCategoryName(): string {
  25. return $this->categoryName;
  26. }
  27. /**
  28. * @param string $categoryName
  29. */
  30. public function setCategoryName(string $categoryName): void {
  31. $this->categoryName = $categoryName;
  32. }
  33. /**
  34. * @return string
  35. */
  36. public function getText(): string {
  37. return $this->text;
  38. }
  39. /**
  40. * @param string $text
  41. */
  42. public function setText(string $text): void {
  43. $this->text = $text;
  44. }
  45. /**
  46. * @return string
  47. */
  48. public function getTitle(): string {
  49. return $this->title;
  50. }
  51. /**
  52. * @param string $title
  53. */
  54. public function setTitle(string $title): void {
  55. $this->title = $title;
  56. }
  57. function jsonSerialize(): mixed {
  58. return [
  59. 'id' => $this->id,
  60. 'title' => $this->title,
  61. 'categoryName' => $this->categoryName,
  62. 'text' => $this->text
  63. ];
  64. }
  65. }