1 | <?php |
||
12 | trait ConvertsToArray |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Main Methods |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | * Get the instance as an array. |
||
21 | * |
||
22 | * @return array |
||
23 | */ |
||
24 | abstract public function toArray(): array; |
||
25 | |||
26 | /** |
||
27 | * Convert the object to its JSON representation. |
||
28 | * |
||
29 | * @param int $options |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | 24 | public function toJson($options = 0): string |
|
37 | |||
38 | /** |
||
39 | * Get the instance as an array to be serialized to JSON. |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | 24 | public function jsonSerialize(): array |
|
47 | } |
||
48 |