Final Class Yiisoft\Yii\Debug\Api\ServerSentEventsStream
| Inheritance | Yiisoft\Yii\Debug\Api\ServerSentEventsStream |
|---|---|
| Implements | Psr\Http\Message\StreamInterface, Stringable |
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $buffer | array | Yiisoft\Yii\Debug\Api\ServerSentEventsStream |
Public Methods
Property Details
Method Details
| public __construct( Closure $stream ): mixed | ||
| $stream | Closure | |
public function __construct(
private Closure $stream,
) {
}
| public getMetadata( mixed $key = null ): array | ||
| $key | mixed | |
public function getMetadata($key = null): array
{
return [];
}
TODO: support length reading
| public read( integer $length ): string | ||
| $length | integer | |
public function read(int $length): string
{
$continue = ($this->stream)($this->buffer);
if (!$continue) {
$this->eof = true;
}
$output = '';
foreach ($this->buffer as $key => $value) {
unset($this->buffer[$key]);
$output .= sprintf("data: %s\n", $value);
}
$output .= "\n";
return $output;
}
| public rewind( ): void |
public function rewind(): void
{
throw new \RuntimeException('Stream is not seekable');
}
| public seek( mixed $offset, mixed $whence = SEEK_SET ): void | ||
| $offset | mixed | |
| $whence | mixed | |
public function seek($offset, $whence = SEEK_SET): void
{
throw new \RuntimeException('Stream is not seekable');
}
Signup or Login in order to comment.