| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace internship\bo;
- use n2n\reflection\ObjectAdapter;
- use n2n\util\type\ArgUtils;
- enum CategoryName: string {
- case sport = 'sport';
- case national ='national';
- case international = 'international';
- }
- class Article extends ObjectAdapter implements \JsonSerializable {
- private int $id;
- private CategoryName $categoryName;
- private string $text;
- private string $title;
- /**
- * @return int
- */
- public function getId(): int {
- return $this->id;
- }
- /**
- * @param int $id
- */
- public function setId(int $id): void {
- $this->id = $id;
- }
- /**
- * @return CategoryName
- */
- public function getCategoryName(): CategoryName {
- return $this->categoryName;
- }
- /**
- * @param CategoryName $categoryName
- */
- public function setCategoryName(CategoryName $categoryName): void {
- //ArgUtils::valEnum($categoryName, CategoryName::cases());
- $this->categoryName = $categoryName;
- }
- /**
- * @return string
- */
- public function getText(): string {
- return $this->text;
- }
- /**
- * @param string $text
- */
- public function setText(string $text): void {
- $this->text = $text;
- }
- /**
- * @return string
- */
- public function getTitle(): string {
- return $this->title;
- }
- /**
- * @param string $title
- */
- public function setTitle(string $title): void {
- $this->title = $title;
- }
- function jsonSerialize(): mixed {
- return [
- 'id' => $this->id,
- 'title' => $this->title,
- 'categoryName' => $this->categoryName,
- 'text' => $this->text
- ];
- }
- }
|