Total Complexity | 10 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class ConsoleOutputStream extends OutputStream |
||
12 | { |
||
13 | /** |
||
14 | * constructor |
||
15 | */ |
||
16 | 4 | public function __construct() |
|
17 | { |
||
18 | 4 | parent::__construct(""); |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | 4 | public function write($buf, int $off = null, int $len = null) |
|
25 | { |
||
26 | $data = null; |
||
27 | 4 | if ($off === null && $len === null) { |
|
28 | 4 | $data = $buf; |
|
29 | 3 | } elseif ($off !== null && $len === null) { |
|
30 | 1 | $data = substr($buf, $off); |
|
31 | 2 | } elseif ($off === null && $len !== null) { |
|
32 | 1 | $data = substr($buf, 0, $len); |
|
33 | } else { |
||
34 | 1 | $data = substr($buf, $off, $len); |
|
35 | } |
||
36 | |||
37 | 4 | $this->stream .= $data; |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | 4 | public function close() |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 4 | public function flush() |
|
54 | } |
||
55 | } |
||
56 |