Skip to content

Commit d6dffbe

Browse files
committed
Add jsonSerialize() and implement JsonSerializable
1 parent 3483e18 commit d6dffbe

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/models/Packet/Form.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
22
namespace BNETDocs\Models\Packet;
3-
class Form extends \BNETDocs\Models\ActiveUser
3+
class Form extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
44
{
55
// possible values for $error:
66
const ERROR_ACL_DENIED = 'ACL_DENIED';
@@ -21,4 +21,18 @@ class Form extends \BNETDocs\Models\ActiveUser
2121
public $form_fields;
2222
public $packet;
2323
public $products;
24+
25+
/**
26+
* Implements the JSON serialization function from the JsonSerializable interface.
27+
*/
28+
public function jsonSerialize()
29+
{
30+
return [
31+
'comments' => $this->comments,
32+
'error' => $this->error,
33+
'form_fields' => $this->form_fields,
34+
'packet' => $this->packet,
35+
'products' => $this->products,
36+
];
37+
}
2438
}

0 commit comments

Comments
 (0)