You are here

private function ServerRequest::getStream in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/ServerRequest.php \Zend\Diactoros\ServerRequest::getStream()

Set the body stream

Parameters

string|resource|StreamInterface $stream:

Return value

StreamInterface

1 call to ServerRequest::getStream()
ServerRequest::__construct in vendor/zendframework/zend-diactoros/src/ServerRequest.php

File

vendor/zendframework/zend-diactoros/src/ServerRequest.php, line 257

Class

ServerRequest
Server-side HTTP request

Namespace

Zend\Diactoros

Code

private function getStream($stream) {
  if ($stream === 'php://input') {
    return new PhpInputStream();
  }
  if (!is_string($stream) && !is_resource($stream) && !$stream instanceof StreamInterface) {
    throw new InvalidArgumentException('Stream must be a string stream resource identifier, ' . 'an actual stream resource, ' . 'or a Psr\\Http\\Message\\StreamInterface implementation');
  }
  if (!$stream instanceof StreamInterface) {
    return new Stream($stream, 'r');
  }
  return $stream;
}