File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,17 @@ Assuming you want a `toJson()` functionality in your document object. First crea
19
19
20
20
``` php
21
21
namespace My\Own
22
- class Document extends \Art4\JsonApiClient\Document
22
+ class Document implements \Art4\JsonApiClient\DocumentInterface
23
23
{
24
+ // Implement the \Art4\JsonApiClient\DocumentInterface here
25
+ /*
26
+ public function get($key);
27
+ public function has($key);
28
+ public function getKeys();
29
+ public function asArray();
30
+ */
31
+
32
+ // your new method
24
33
public function toJson()
25
34
{
26
35
return json_encode($this->asArray(true));
Original file line number Diff line number Diff line change 8
8
trait AccessTrait
9
9
{
10
10
/**
11
- * Check if a value exists in this document
11
+ * Check if a value exists in this object
12
12
*
13
13
* @param string $key The key of the value
14
14
* @return bool true if data exists, false if not
@@ -19,7 +19,7 @@ public function has($key)
19
19
}
20
20
21
21
/**
22
- * Returns the keys of all setted values in this document
22
+ * Returns the keys of all setted values in this object
23
23
*
24
24
* @return array Keys of all setted values
25
25
*/
You can’t perform that action at this time.
0 commit comments