本文整理汇总了PHP中Psr\Http\Message\StreamInterface::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP StreamInterface::__toString方法的具体用法?PHP StreamInterface::__toString怎么用?PHP StreamInterface::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Http\Message\StreamInterface
的用法示例。
在下文中一共展示了StreamInterface::__toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: let
function let(ServerRequestInterface $request, StreamInterface $stream, EventDispatcherInterface $dispatcher)
{
$payload = '
{
"object": "page",
"entry": [
{
"id": "PAGE_ID",
"time": 1473204787206,
"messaging": [
{
"sender":{
"id":"USER_ID"
},
"recipient":{
"id":"PAGE_ID"
},
"timestamp":1458692752478,
"message":{
"mid":"mid.1457764197618:41d102a3e1ae206a38",
"seq":73,
"text":"hello, world!",
"quick_reply": {
"payload": "DEVELOPER_DEFINED_PAYLOAD"
}
}
}
]
}
]
}
';
$stream->__toString()->willReturn($payload);
$signature = XHubSignature::compute($payload, 'secret');
$request->getBody()->willReturn($stream);
$request->getHeader('X-Hub-Signature')->willReturn(['sha1=' . $signature]);
$this->beConstructedWith('secret', 'verify_token', $request, $dispatcher);
}
示例2: testNullToString
public function testNullToString()
{
$this->assertSame('', $this->stream->__toString());
}
示例3: __toString
public function __toString()
{
return $this->stream->__toString();
}
示例4: __toString
/**
* @return string
*/
public function __toString()
{
return $this->responseData->__toString();
}
示例5:
function it_returns_an_APOD_object_with_the_same_date_the_response_has(Client $httpClient, ResponseInterface $response, StreamInterface $responseBodyStream)
{
$date = '2016-01-01';
$responseBody = $this->defaultResponseBody;
$responseBody['date'] = $date;
$responseBodyStream->__toString()->willReturn(json_encode($responseBody));
$response->getBody()->willReturn($responseBodyStream);
$apod = $this->get();
$datetime = $apod->getDateTime();
$datetime->format('Y-m-d')->shouldBe($date);
}
示例6: withBody
public function withBody(StreamInterface $body)
{
$this->body = $body->__toString();
return $this;
}