本文整理汇总了PHP中Psr\Http\Message\StreamInterface::close方法的典型用法代码示例。如果您正苦于以下问题:PHP StreamInterface::close方法的具体用法?PHP StreamInterface::close怎么用?PHP StreamInterface::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Http\Message\StreamInterface
的用法示例。
在下文中一共展示了StreamInterface::close方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Sends response to output.
* @param IRequest $request
* @param IResponse $response
*/
public function send(IRequest $request, IResponse $response)
{
// Set response headers for the file download
$response->setHeader('Content-Length', $this->stream->getSize());
$response->setHeader('Content-Type', $this->contentType);
$response->setHeader('Content-Disposition', 'attachment; filename="' . $this->name . '";');
while (!$this->stream->eof()) {
echo $this->stream->read(4000000.0);
}
$this->stream->close();
}
示例2: close
/**
* {@inheritdoc}
*/
public function close()
{
if ($this->stream !== NULL) {
try {
if ($this->closeCascade) {
$this->stream->close();
}
} finally {
$this->stream = NULL;
}
}
}
示例3: close
/**
* {@inheritdoc}
*/
public function close($closeStream = false)
{
if (self::STATE_FIRST_ELEMENT != ($this->state | self::STATE_FIRST_ELEMENT)) {
throw new JsonSerializationException('JSON syntax error, unfinished array or object detected', self::ERROR_GENERIC);
}
if ($closeStream) {
$this->stream->close();
}
}
示例4: wrapBodyStream
/**
* @param StreamInterface $stream
* @return StreamInterface
*/
private static function wrapBodyStream(StreamInterface $stream)
{
$eofStream = false;
$methods = ['close' => function () use($stream, &$eofStream) {
$stream->close();
$eofStream = true;
}, 'eof' => function () use($stream, &$eofStream) {
return $eofStream || $stream->eof();
}];
//\GuzzleHttp\Stream\FnStream::decorate($stream, $methods);
return \GuzzleHttp\Psr7\FnStream::decorate($stream, $methods);
}
示例5: close
/**
* {@inheritdoc}
*/
public function close()
{
$this->stream->close();
}
示例6: close
/**
* {@inheritdoc}
*/
public function close()
{
$this->decoratedStream->close();
}
示例7: close
public function close()
{
return $this->stream->close();
}
示例8: testCloses
public function testCloses()
{
$this->b->close();
$this->assertFalse(is_resource($this->c));
}