status; } /** * @return string Тело ответа */ public function body(): string { return $this->body; } /** * @return bool true, если статус в диапазоне 2xx */ public function isSuccess(): bool { return $this->status >= 200 && $this->status < 300; } /** * Декодирует тело ответа как JSON. * * @return array Пустой массив, если тело пустое * @throws JsonException При некорректном JSON */ public function json(): array { if ($this->body === '') { return []; } return json_decode($this->body, true, 512, JSON_THROW_ON_ERROR); } }