Skip to content

Commit

Permalink
Add jsonSerialize() and implement JsonSerializable
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbennett committed Jul 18, 2021
1 parent 3483e18 commit d6dffbe
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/models/Packet/Form.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
namespace BNETDocs\Models\Packet;
class Form extends \BNETDocs\Models\ActiveUser
class Form extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
{
// possible values for $error:
const ERROR_ACL_DENIED = 'ACL_DENIED';
Expand All @@ -21,4 +21,18 @@ class Form extends \BNETDocs\Models\ActiveUser
public $form_fields;
public $packet;
public $products;

/**
* Implements the JSON serialization function from the JsonSerializable interface.
*/
public function jsonSerialize()
{
return [
'comments' => $this->comments,
'error' => $this->error,
'form_fields' => $this->form_fields,
'packet' => $this->packet,
'products' => $this->products,
];
}
}

0 comments on commit d6dffbe

Please sign in to comment.