public function Request::getContent

Returns the request body content.

Parameters

Boolean $asResource If true, a resource will be returned:

Return value

string|resource The request body content or a resource to read the body stream.

1 call to Request::getContent()
Request::__toString in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Returns the request as a string.
1 method overrides Request::getContent()
RequestContentProxy::getContent in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Returns the request body content.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 1111

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getContent($asResource = false) {
  if (false === $this->content || true === $asResource && null !== $this->content) {
    throw new \LogicException('getContent() can only be called once when using the resource return type.');
  }
  if (true === $asResource) {
    $this->content = false;
    return fopen('php://input', 'rb');
  }
  if (null === $this->content) {
    $this->content = file_get_contents('php://input');
  }
  return $this->content;
}