| @@ 93-115 (lines=23) @@ | ||
| 90 | * @override |
|
| 91 | * @inheritDoc |
|
| 92 | */ |
|
| 93 | public function write($text = '') |
|
| 94 | { |
|
| 95 | if (!$this->writable) |
|
| 96 | { |
|
| 97 | return $this->throwAndEmitException( |
|
| 98 | new WriteException('Stream is no longer writable.') |
|
| 99 | ); |
|
| 100 | } |
|
| 101 | ||
| 102 | $sent = fwrite($this->resource, $text); |
|
| 103 | ||
| 104 | if ($sent === false) |
|
| 105 | { |
|
| 106 | return $this->throwAndEmitException( |
|
| 107 | new WriteException('Error occurred while writing to the stream resource.') |
|
| 108 | ); |
|
| 109 | } |
|
| 110 | ||
| 111 | $this->emit('drain', [ $this ]); |
|
| 112 | $this->emit('finish', [ $this ]); |
|
| 113 | ||
| 114 | return true; |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * @override |
|
| @@ 76-98 (lines=23) @@ | ||
| 73 | * @override |
|
| 74 | * @inheritDoc |
|
| 75 | */ |
|
| 76 | public function write($text = '') |
|
| 77 | { |
|
| 78 | if (!$this->writable) |
|
| 79 | { |
|
| 80 | return $this->throwAndEmitException( |
|
| 81 | new WriteException('Stream is no longer writable.') |
|
| 82 | ); |
|
| 83 | } |
|
| 84 | ||
| 85 | $sent = fwrite($this->resource, $text); |
|
| 86 | ||
| 87 | if ($sent === false) |
|
| 88 | { |
|
| 89 | return $this->throwAndEmitException( |
|
| 90 | new WriteException('Error occurred while writing to the stream resource.') |
|
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | $this->emit('drain', [ $this ]); |
|
| 95 | $this->emit('finish', [ $this ]); |
|
| 96 | ||
| 97 | return true; |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * @override |
|