function Response::toArray
File
-
vendor/
symfony/ browser-kit/ Response.php, line 91
Class
- Response
- @author Fabien Potencier <fabien@symfony.com>
Namespace
Symfony\Component\BrowserKitCode
public function toArray() : array {
if (isset($this->jsonData)) {
return $this->jsonData;
}
try {
$content = json_decode($this->content, true, flags: \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
} catch (\JsonException $e) {
throw new JsonException($e->getMessage(), $e->getCode(), $e);
}
if (!\is_array($content)) {
throw new JsonException(\sprintf('JSON content was expected to decode to an array, "%s" returned.', get_debug_type($content)));
}
return $this->jsonData = $content;
}