WritableStream::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Thruster\Component\Stream;
4
5
use Thruster\Component\EventEmitter\EventEmitterTrait;
6
7
/**
8
 * Class WritableStream
9
 *
10
 * @package Thruster\Component\Stream
11
 * @author  Aurimas Niekis <[email protected]>
12
 */
13
class WritableStream extends BaseStream implements WritableStreamInterface
14
{
15 30
    public function __construct()
16
    {
17 30
        $this->closed = false;
18 30
    }
19
20
    /**
21
     * {@inheritDoc}
22
     */
23 2
    public function write($data)
24
    {
25 2
    }
26
27
    /**
28
     * {@inheritDoc}
29
     */
30 9
    public function end($data = null) : self
31
    {
32 9
        if (null !== $data) {
33 3
            $this->write($data);
34
        }
35
36 9
        $this->close();
37
38 9
        return $this;
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44 10
    public function isWritable() : bool
45
    {
46 10
        return !$this->closed;
47
    }
48
}
49