WritableStream   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 36
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A write() 0 3 1
A isWritable() 0 4 1
A end() 0 10 2
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