Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
namespace React\Stream;
4
 
5
use Evenement\EventEmitter;
6
 
7
class WritableStream extends EventEmitter implements WritableStreamInterface
8
{
9
    protected $closed = false;
10
 
11
    public function write($data)
12
    {
13
    }
14
 
15
    public function end($data = null)
16
    {
17
        if (null !== $data) {
18
            $this->write($data);
19
        }
20
 
21
        $this->close();
22
    }
23
 
24
    public function isWritable()
25
    {
26
        return !$this->closed;
27
    }
28
 
29
    public function close()
30
    {
31
        if ($this->closed) {
32
            return;
33
        }
34
 
35
        $this->closed = true;
36
        $this->emit('end', array($this));
37
        $this->emit('close', array($this));
38
        $this->removeAllListeners();
39
    }
40
}