Article.php 1.2 KB

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