PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/google/guzzlehttp/psr7/src/AppendStream.php +22 -22 1.0.0 → 1.4.2 View file →
@@ -1,10 +1,10 @@
1 1 <?php
2 2
3 3 declare (strict_types=1);
4 -namespace Dudlewebs\WPMCS\GuzzleHttp\Psr7;
4 +namespace Dudlewebs\WPMCS\GCP\GuzzleHttp\Psr7;
5 5
6 -use Dudlewebs\WPMCS\Psr\Http\Message\StreamInterface;
6 +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\StreamInterface;
7 7 /**
8 8 * Reads from multiple streams, one after the other.
9 9 *
10 10 * This is a read-only stream decorator.
@@ -28,9 +28,9 @@
28 28 foreach ($streams as $stream) {
29 29 $this->addStream($stream);
30 30 }
31 31 }
32 - public function __toString(): string
32 + public function __toString() : string
33 33 {
34 34 try {
35 35 $this->rewind();
36 36 return $this->getContents();
@@ -37,9 +37,9 @@
37 37 } catch (\Throwable $e) {
38 38 if (\PHP_VERSION_ID >= 70400) {
39 39 throw $e;
40 40 }
41 - trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
41 + \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
42 42 return '';
43 43 }
44 44 }
45 45 /**
@@ -48,9 +48,9 @@
48 48 * @param StreamInterface $stream Stream to append. Must be readable.
49 49 *
50 50 * @throws \InvalidArgumentException if the stream is not readable
51 51 */
52 - public function addStream(StreamInterface $stream): void
52 + public function addStream(StreamInterface $stream) : void
53 53 {
54 54 if (!$stream->isReadable()) {
55 55 throw new \InvalidArgumentException('Each stream must be readable');
56 56 }
@@ -59,9 +59,9 @@
59 59 $this->seekable = \false;
60 60 }
61 61 $this->streams[] = $stream;
62 62 }
63 - public function getContents(): string
63 + public function getContents() : string
64 64 {
65 65 return Utils::copyToString($this);
66 66 }
67 67 /**
@@ -66,9 +66,9 @@
66 66 }
67 67 /**
68 68 * Closes each attached stream.
69 69 */
70 - public function close(): void
70 + public function close() : void
71 71 {
72 72 $this->pos = $this->current = 0;
73 73 $this->seekable = \true;
74 74 foreach ($this->streams as $stream) {
@@ -90,9 +90,9 @@
90 90 }
91 91 $this->streams = [];
92 92 return null;
93 93 }
94 - public function tell(): int
94 + public function tell() : int
95 95 {
96 96 return $this->pos;
97 97 }
98 98 /**
@@ -100,9 +100,9 @@
100 100 *
101 101 * If any of the streams do not return a valid number, then the size of the
102 102 * append stream cannot be determined and null is returned.
103 103 */
104 - public function getSize(): ?int
104 + public function getSize() : ?int
105 105 {
106 106 $size = 0;
107 107 foreach ($this->streams as $stream) {
108 108 $s = $stream->getSize();
@@ -112,13 +112,13 @@
112 112 $size += $s;
113 113 }
114 114 return $size;
115 115 }
116 - public function eof(): bool
116 + public function eof() : bool
117 117 {
118 - return !$this->streams || $this->current >= count($this->streams) - 1 && $this->streams[$this->current]->eof();
118 + return !$this->streams || $this->current >= \count($this->streams) - 1 && $this->streams[$this->current]->eof();
119 119 }
120 - public function rewind(): void
120 + public function rewind() : void
121 121 {
122 122 $this->seek(0);
123 123 }
124 124 /**
@@ -123,9 +123,9 @@
123 123 }
124 124 /**
125 125 * Attempts to seek to the given position. Only supports SEEK_SET.
126 126 */
127 - public function seek($offset, $whence = \SEEK_SET): void
127 + public function seek($offset, $whence = \SEEK_SET) : void
128 128 {
129 129 if (!$this->seekable) {
130 130 throw new \RuntimeException('This AppendStream is not seekable');
131 131 } elseif ($whence !== \SEEK_SET) {
@@ -141,9 +141,9 @@
141 141 }
142 142 }
143 143 // Seek to the actual position by reading from each stream
144 144 while ($this->pos < $offset && !$this->eof()) {
145 - $result = $this->read(min(8096, $offset - $this->pos));
145 + $result = $this->read(\min(8096, $offset - $this->pos));
146 146 if ($result === '') {
147 147 break;
148 148 }
149 149 }
@@ -150,12 +150,12 @@
150 150 }
151 151 /**
152 152 * Reads from all of the appended streams until the length is met or EOF.
153 153 */
154 - public function read($length): string
154 + public function read($length) : string
155 155 {
156 156 $buffer = '';
157 - $total = count($this->streams) - 1;
157 + $total = \count($this->streams) - 1;
158 158 $remaining = $length;
159 159 $progressToNext = \false;
160 160 while ($remaining > 0) {
161 161 // Progress to the next stream if needed.
@@ -171,26 +171,26 @@
171 171 $progressToNext = \true;
172 172 continue;
173 173 }
174 174 $buffer .= $result;
175 - $remaining = $length - strlen($buffer);
175 + $remaining = $length - \strlen($buffer);
176 176 }
177 - $this->pos += strlen($buffer);
177 + $this->pos += \strlen($buffer);
178 178 return $buffer;
179 179 }
180 - public function isReadable(): bool
180 + public function isReadable() : bool
181 181 {
182 182 return \true;
183 183 }
184 - public function isWritable(): bool
184 + public function isWritable() : bool
185 185 {
186 186 return \false;
187 187 }
188 - public function isSeekable(): bool
188 + public function isSeekable() : bool
189 189 {
190 190 return $this->seekable;
191 191 }
192 - public function write($string): int
192 + public function write($string) : int
193 193 {
194 194 throw new \RuntimeException('Cannot write to an AppendStream');
195 195 }
196 196 /**