1 | <?php |
||
14 | trait ConvertibleTrait |
||
15 | { |
||
16 | /** |
||
17 | * Convert the current array to a string with default separator. |
||
18 | * |
||
19 | * @return string A string representation of the current array |
||
20 | */ |
||
21 | 3 | public function __toString() |
|
25 | |||
26 | /** |
||
27 | * Convert the current array to a native PHP array. |
||
28 | * |
||
29 | * @return array A native PHP array |
||
30 | */ |
||
31 | 197 | public function toArray() |
|
35 | |||
36 | /** |
||
37 | * Implode the current array to a readable string with specified separator. |
||
38 | * |
||
39 | * @param string $separator The element's separator |
||
40 | * @param string $conjunction The last element conjunction |
||
41 | * |
||
42 | * @return string A readable string representation of the current array |
||
43 | * |
||
44 | * @link http://php.net/manual/en/function.implode.php |
||
45 | */ |
||
46 | 1 | public function toReadableString($separator = AbstractArray::DEFAULT_SEPARATOR, $conjunction = ' and ') |
|
56 | |||
57 | /** |
||
58 | * Implode the current array to a string with specified separator. |
||
59 | * |
||
60 | * @param string $separator The element's separator |
||
61 | * |
||
62 | * @return string A string representation of the current array |
||
63 | * |
||
64 | * @link http://php.net/manual/en/function.implode.php |
||
65 | */ |
||
66 | 3 | public function toString($separator = AbstractArray::DEFAULT_SEPARATOR) |
|
70 | |||
71 | /** |
||
72 | * Encode the current array to a JSON string. |
||
73 | * |
||
74 | * @param int $options The bitmask |
||
75 | * @param int $depth The maximum depth (must be greater than zero) |
||
76 | * |
||
77 | * @return string A JSON string representation of the current array |
||
78 | * |
||
79 | * @link http://php.net/manual/en/function.json-encode.php |
||
80 | */ |
||
81 | 4 | public function toJson($options = 0, $depth = 512) |
|
95 | } |
||
96 |