1 | <?php |
||
15 | class BufferedStream implements StreamInterface |
||
16 | { |
||
17 | /** @var resource The buffered resource used to seek previous data */ |
||
18 | private $resource; |
||
19 | |||
20 | /** @var int size of the stream if available */ |
||
21 | private $size; |
||
22 | |||
23 | /** @var StreamInterface The underlying stream decorated by this class */ |
||
24 | private $stream; |
||
25 | |||
26 | /** @var int How many bytes were written */ |
||
27 | private $written = 0; |
||
28 | |||
29 | /** |
||
30 | * @param StreamInterface $stream Decorated stream |
||
31 | * @param bool $useFileBuffer Whether to use a file buffer (write to a file, if data exceed a certain size) |
||
32 | * by default, set this to false to only use memory |
||
33 | * @param int $memoryBuffer In conjunction with using file buffer, limit (in bytes) from which it begins to buffer |
||
34 | * the data in a file |
||
35 | */ |
||
36 | 13 | public function __construct(StreamInterface $stream, $useFileBuffer = true, $memoryBuffer = 2097152) |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 1 | public function __toString() |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function close() |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | 1 | public function detach() |
|
85 | { |
||
86 | 1 | if (null === $this->resource) { |
|
87 | 1 | return; |
|
88 | } |
||
89 | |||
90 | // Force reading the remaining data of the stream |
||
91 | 1 | $this->getContents(); |
|
92 | |||
93 | 1 | $resource = $this->resource; |
|
94 | 1 | $this->stream->close(); |
|
95 | 1 | $this->stream = null; |
|
96 | 1 | $this->resource = null; |
|
97 | |||
98 | 1 | return $resource; |
|
99 | } |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | 1 | public function getSize() |
|
105 | { |
||
106 | 1 | if (null === $this->resource) { |
|
107 | return; |
||
108 | } |
||
109 | |||
110 | 1 | if (null === $this->size && $this->stream->eof()) { |
|
111 | 1 | return $this->written; |
|
112 | } |
||
113 | |||
114 | 1 | return $this->size; |
|
115 | } |
||
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | 3 | public function tell() |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 8 | public function eof() |
|
133 | { |
||
134 | 8 | if (null === $this->resource) { |
|
135 | throw new \RuntimeException('Cannot call eof on a detached stream'); |
||
136 | } |
||
137 | |||
138 | // We are at the end only when both our resource and underlying stream are at eof |
||
139 | 8 | return $this->stream->eof() && (ftell($this->resource) === $this->written); |
|
140 | } |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | 1 | public function isSeekable() |
|
146 | { |
||
147 | 1 | return null !== $this->resource; |
|
148 | } |
||
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | 2 | public function seek($offset, $whence = SEEK_SET) |
|
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | 3 | public function rewind() |
|
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | 1 | public function isWritable() |
|
181 | |||
182 | /** |
||
183 | * {@inheritdoc} |
||
184 | */ |
||
185 | 1 | public function write($string) |
|
189 | |||
190 | /** |
||
191 | * {@inheritdoc} |
||
192 | */ |
||
193 | 1 | public function isReadable() |
|
197 | |||
198 | /** |
||
199 | * {@inheritdoc} |
||
200 | */ |
||
201 | 8 | public function read($length) |
|
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | 8 | public function getContents() |
|
244 | |||
245 | /** |
||
246 | * {@inheritdoc} |
||
247 | */ |
||
248 | 1 | public function getMetadata($key = null) |
|
270 | } |
||
271 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.