Aerys\StandardRequest::getBody PHP Method

getBody() public method

public getBody ( integer $bodySize ) : Body
$bodySize integer
return Body
    public function getBody(int $bodySize = -1) : Body
    {
        $ireq = $this->internalRequest;
        if ($bodySize > -1) {
            if ($bodySize > ($ireq->maxBodySize ?? $ireq->client->options->maxBodySize)) {
                $ireq->maxBodySize = $bodySize;
                $ireq->client->httpDriver->upgradeBodySize($this->internalRequest);
            }
        }
        if ($ireq->body != $this->body) {
            $this->body = $ireq->body->when(function ($e, $data) {
                if ($e instanceof ClientSizeException) {
                    $ireq = $this->internalRequest;
                    $bodyPromisor = $ireq->client->bodyPromisors[$ireq->streamId];
                    $ireq->body = new Body($bodyPromisor);
                    $bodyPromisor->update($data);
                }
            });
        }
        return $ireq->body;
    }