Phly\Http\Request\Serializer::fromString PHP Method

fromString() public static method

Internally, casts the message to a stream and invokes fromStream().
public static fromString ( string $message ) : Request
$message string
return Phly\Http\Request
    public static function fromString($message)
    {
        $stream = new Stream('php://temp', 'wb+');
        $stream->write($message);
        return self::fromStream($stream);
    }

Usage Example

Beispiel #1
0
 /**
  * @dataProvider messagesWithInvalidHeaders
  */
 public function testDeserializationRaisesExceptionForMalformedHeaders($message, $exceptionMessage)
 {
     $this->setExpectedException('UnexpectedValueException', $exceptionMessage);
     $request = Serializer::fromString($message);
 }