You are here

public static function Serializer::fromString in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/Request/Serializer.php \Zend\Diactoros\Request\Serializer::fromString()
  2. 8 vendor/zendframework/zend-diactoros/src/Response/Serializer.php \Zend\Diactoros\Response\Serializer::fromString()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Request/Serializer.php \Zend\Diactoros\Request\Serializer::fromString()

Deserialize a request string to a request instance.

Internally, casts the message to a stream and invokes fromStream().

Parameters

string $message:

Return value

Request

Throws

UnexpectedValueException when errors occur parsing the message.

File

vendor/zendframework/zend-diactoros/src/Request/Serializer.php, line 39

Class

Serializer
Serialize (cast to string) or deserialize (cast string to Request) messages.

Namespace

Zend\Diactoros\Request

Code

public static function fromString($message) {
  $stream = new Stream('php://temp', 'wb+');
  $stream
    ->write($message);
  return self::fromStream($stream);
}