| @@ -3,13 +3,12 @@ | ||
| 3 | 3 | |
| 4 | 4 | use JsonSerializable; |
| 5 | 5 | |
| 6 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | - exit; // Exit if accessed directly. | |
| 7 | + exit; // Exit if accessed directly | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | class Section implements JsonSerializable { |
| 11 | - private ?string $id = null; | |
| 12 | 11 | private $label = null; |
| 13 | 12 | private $description = null; |
| 14 | 13 | private array $items = []; |
| 15 | 14 | |
| @@ -16,30 +15,16 @@ | ||
| 16 | 15 | public static function make(): self { |
| 17 | 16 | return new static(); |
| 18 | 17 | } |
| 19 | 18 | |
| 20 | - public function set_id( string $id ): self { | |
| 21 | - $this->id = $id; | |
| 22 | - | |
| 23 | - return $this; | |
| 24 | - } | |
| 25 | - | |
| 26 | - public function get_id() { | |
| 27 | - return $this->id; | |
| 28 | - } | |
| 29 | - | |
| 30 | 19 | public function set_label( string $label ): self { |
| 31 | - $this->label = html_entity_decode( $label ); | |
| 20 | + $this->label = $label; | |
| 32 | 21 | |
| 33 | 22 | return $this; |
| 34 | 23 | } |
| 35 | 24 | |
| 36 | - public function get_label(): ?string { | |
| 37 | - return $this->label; | |
| 38 | - } | |
| 39 | - | |
| 40 | 25 | public function set_description( string $description ): self { |
| 41 | - $this->description = html_entity_decode( $description ); | |
| 26 | + $this->description = $description; | |
| 42 | 27 | |
| 43 | 28 | return $this; |
| 44 | 29 | } |
| 45 | 30 | |
| @@ -48,14 +33,8 @@ | ||
| 48 | 33 | |
| 49 | 34 | return $this; |
| 50 | 35 | } |
| 51 | 36 | |
| 52 | - public function add_item( $item ): self { | |
| 53 | - $this->items[] = $item; | |
| 54 | - | |
| 55 | - return $this; | |
| 56 | - } | |
| 57 | - | |
| 58 | 37 | public function get_items() { |
| 59 | 38 | return $this->items; |
| 60 | 39 | } |
| 61 | 40 | |
| @@ -62,12 +41,11 @@ | ||
| 62 | 41 | public function jsonSerialize(): array { |
| 63 | 42 | return [ |
| 64 | 43 | 'type' => 'section', |
| 65 | 44 | 'value' => [ |
| 66 | - 'id' => $this->id, | |
| 67 | - 'label' => $this->label, | |
| 45 | + 'label' => $this->label, | |
| 68 | 46 | 'description' => $this->description, |
| 69 | - 'items' => $this->items, | |
| 47 | + 'items' => $this->items, | |
| 70 | 48 | ], |
| 71 | 49 | ]; |
| 72 | 50 | } |
| 73 | 51 | } |