Skip to content

Commit 02191f4

Browse files
committed
Make ThroughStream extend ReadableStream (thanks @elazar)
1 parent 0be54fe commit 02191f4

1 file changed

Lines changed: 2 additions & 19 deletions

File tree

ThroughStream.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
use Evenement\EventEmitter;
66

7-
class ThroughStream extends EventEmitter implements ReadableStreamInterface, WritableStreamInterface
7+
class ThroughStream extends ReadableStream implements WritableStreamInterface
88
{
9-
private $closed = false;
109
private $pipeSource;
1110

1211
public function __construct()
@@ -38,11 +37,6 @@ public function end($data = null)
3837
$this->close();
3938
}
4039

41-
public function isReadable()
42-
{
43-
return !$this->closed;
44-
}
45-
4640
public function isWritable()
4741
{
4842
return !$this->closed;
@@ -68,18 +62,7 @@ public function close()
6862
return;
6963
}
7064

71-
$this->closed = true;
65+
parent::close();
7266
$this->pipeSource = null;
73-
74-
$this->emit('end');
75-
$this->emit('close');
76-
$this->removeAllListeners();
77-
}
78-
79-
public function pipe(WritableStreamInterface $dest, array $options = array())
80-
{
81-
Util::pipe($this, $dest, $options);
82-
83-
return $dest;
8467
}
8568
}

0 commit comments

Comments
 (0)