| @@ 100-111 (lines=12) @@ | ||
| 97 | * |
|
| 98 | * @return string |
|
| 99 | */ |
|
| 100 | public function json(bool $beautify = false): string |
|
| 101 | { |
|
| 102 | if (null === $serialized = $this->serialize()) { |
|
| 103 | return ''; |
|
| 104 | } |
|
| 105 | ||
| 106 | if ($beautify) { |
|
| 107 | return json_encode($serialized, JSON_PRETTY_PRINT); |
|
| 108 | } |
|
| 109 | ||
| 110 | return json_encode($serialized); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| @@ 203-214 (lines=12) @@ | ||
| 200 | * |
|
| 201 | * @return string |
|
| 202 | */ |
|
| 203 | public function json(bool $beautify = false): string |
|
| 204 | { |
|
| 205 | if (null === $serialized = $this->serialize()) { |
|
| 206 | return ''; |
|
| 207 | } |
|
| 208 | ||
| 209 | if ($beautify) { |
|
| 210 | return json_encode($serialized, JSON_PRETTY_PRINT); |
|
| 211 | } |
|
| 212 | ||
| 213 | return json_encode($serialized); |
|
| 214 | } |
|
| 215 | } |
|
| 216 | ||