1 | <?php |
||
10 | class MemoryClonedStream implements StreamInterface |
||
11 | { |
||
12 | const COPY_BUFFER = 8192; |
||
13 | |||
14 | private $resource; |
||
15 | |||
16 | private $size; |
||
17 | |||
18 | /** |
||
19 | * @param StreamInterface $stream Stream to clone |
||
20 | * @param bool $useFileBuffer Use a file buffer to avoid memory consumption on PHP script (default to true) |
||
21 | * @param int $memoryBuffer The amount of memory of which the stream is buffer into a file when setting |
||
22 | * $useFileBuffer to true (default to 2MB) |
||
23 | */ |
||
24 | public function __construct(StreamInterface $stream, $useFileBuffer = true, $memoryBuffer = 2097152) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function __toString() |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function close() |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function detach() |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | public function getSize() |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function tell() |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function eof() |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function isSeekable() |
||
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | public function seek($offset, $whence = SEEK_SET) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function rewind() |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function isWritable() |
||
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | */ |
||
138 | public function write($string) |
||
142 | |||
143 | /** |
||
144 | * {@inheritdoc} |
||
145 | */ |
||
146 | public function isReadable() |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function read($length) |
||
158 | |||
159 | /** |
||
160 | * {@inheritdoc} |
||
161 | */ |
||
162 | public function getContents() |
||
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | */ |
||
172 | public function getMetadata($key = null) |
||
182 | } |
||
183 |