1 | <?php |
||
8 | final class LazyStream implements StreamInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var \Closure |
||
12 | */ |
||
13 | private $callback; |
||
14 | /** |
||
15 | * @var StreamInterface |
||
16 | */ |
||
17 | private $decoratedStream; |
||
18 | |||
19 | /** |
||
20 | * LazyStream constructor. |
||
21 | * @param \Closure $callback |
||
22 | */ |
||
23 | 22 | public function __construct(\Closure $callback) |
|
27 | |||
28 | /** |
||
29 | * @return string |
||
30 | */ |
||
31 | 21 | public function __toString(): string |
|
35 | |||
36 | /** |
||
37 | * |
||
38 | */ |
||
39 | public function close(): void |
||
43 | |||
44 | /** |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function detach() |
||
51 | |||
52 | /** |
||
53 | * @return int|null |
||
54 | */ |
||
55 | public function getSize(): ?int |
||
59 | |||
60 | /** |
||
61 | * @return int |
||
62 | * @throws \RuntimeException |
||
63 | */ |
||
64 | public function tell(): int |
||
68 | |||
69 | /** |
||
70 | * @return bool |
||
71 | */ |
||
72 | 1 | public function eof(): bool |
|
76 | |||
77 | /** |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function isSeekable(): bool |
||
84 | |||
85 | /** |
||
86 | * @param int $offset |
||
87 | * @param int $whence |
||
88 | * @return int |
||
89 | */ |
||
90 | public function seek(int $offset, int $whence = SEEK_SET): int |
||
94 | |||
95 | /** |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function rewind(): bool |
||
102 | |||
103 | /** |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function isWritable(): bool |
||
110 | |||
111 | /** |
||
112 | * @param $string |
||
113 | * @return int |
||
114 | */ |
||
115 | public function write($string): int |
||
119 | |||
120 | /** |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function isReadable(): bool |
||
127 | |||
128 | /** |
||
129 | * @param int $length |
||
130 | * @return string |
||
131 | */ |
||
132 | 1 | public function read(int $length): string |
|
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | */ |
||
140 | public function getContents(): string |
||
144 | |||
145 | /** |
||
146 | * @param array $keys |
||
147 | * @return array |
||
148 | */ |
||
149 | public function getMetadata(array $keys = []): array |
||
153 | |||
154 | /** |
||
155 | * @return StreamInterface |
||
156 | */ |
||
157 | 22 | private function getStream(): StreamInterface |
|
166 | } |