post_id, $this->id ); } /** * @return string */ public function get_label() { return "{$this->name} ($this->id)"; } /** * Implement for the JsonSerializable method, will trigger when trying to json_encode this object. * * @return array */ #[\ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->id, 'name' => $this->name, 'fields' => $this->fields, ]; } /** * Form constructor. * * @param $post_id * @param $data */ public function __construct( $post_id, $data ) { $this->post_id = (int) $post_id; $this->id = $data['id']; $this->name = $data['name']; $this->fields = $data['fields']; } }