Passed
Pull Request — master (#602)
by Aleksei
07:06
created

NotReadableStream   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 74
rs 10
wmc 15

15 Methods

Rating   Name   Duplication   Size   Complexity  
A isSeekable() 0 3 1
A write() 0 3 1
A rewind() 0 3 1
A detach() 0 3 1
A __toString() 0 3 1
A seek() 0 3 1
A getContents() 0 3 1
A getMetadata() 0 3 1
A isReadable() 0 3 1
A tell() 0 3 1
A getSize() 0 3 1
A eof() 0 3 1
A close() 0 2 1
A read() 0 3 1
A isWritable() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Tests\Http\SapiEmitter\Support;
6
7
use Psr\Http\Message\StreamInterface;
8
9
/**
10
 * @source https://github.com/yiisoft/yii-web/blob/master/tests/Emitter/Support/NotReadableStream.php
11
 * @license MIT
12
 * @copyright Yii Software LLC (http://www.yiisoft.com) All rights reserved.
13
 */
14
class NotReadableStream implements StreamInterface
15
{
16
    public function __toString(): string
17
    {
18
        throw new \RuntimeException();
19
    }
20
21
    public function close(): void
22
    {
23
    }
24
25
    public function detach()
26
    {
27
        return null;
28
    }
29
30
    public function getSize(): ?int
31
    {
32
        return null;
33
    }
34
35
    public function tell(): int
36
    {
37
        throw new \RuntimeException();
38
    }
39
40
    public function eof(): bool
41
    {
42
        return false;
43
    }
44
45
    public function isSeekable(): bool
46
    {
47
        return false;
48
    }
49
50
    public function seek($offset, $whence = SEEK_SET): void
51
    {
52
        throw new \RuntimeException();
53
    }
54
55
    public function rewind(): void
56
    {
57
        throw new \RuntimeException();
58
    }
59
60
    public function isWritable(): bool
61
    {
62
        return false;
63
    }
64
65
    public function write($string): int
66
    {
67
        throw new \RuntimeException();
68
    }
69
70
    public function isReadable(): bool
71
    {
72
        return false;
73
    }
74
75
    public function read($length): string
76
    {
77
        throw new \RuntimeException();
78
    }
79
80
    public function getContents(): string
81
    {
82
        throw new \RuntimeException();
83
    }
84
85
    public function getMetadata($key = null)
86
    {
87
        return null;
88
    }
89
}
90