ReadableStream   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isReadable() 0 4 1
A pause() 0 4 1
A resume() 0 4 1
A pipe() 0 6 1
1
<?php
2
3
namespace Thruster\Component\Stream;
4
5
/**
6
 * Class ReadableStream
7
 *
8
 * @package Thruster\Component\Stream
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
class ReadableStream extends BaseStream implements ReadableStreamInterface
12
{
13 24
    public function __construct()
14
    {
15 24
        $this->closed = false;
16 24
    }
17
18
    /**
19
     * {@inheritDoc}
20
     */
21 8
    public function isReadable() : bool
22
    {
23 8
        return !$this->closed;
24
    }
25
26
    /**
27
     * {@inheritDoc}
28
     */
29 2
    public function pause() : self
30
    {
31 2
        return $this;
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     */
37 2
    public function resume() : self
38
    {
39 2
        return $this;
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45 9
    public function pipe(WritableStreamInterface $dest, array $options = [])
46
    {
47 9
        $this->pipeAll($this, $dest, $options);
48
49 9
        return $dest;
50
    }
51
}
52