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/PumpStream.php +20 -20 1.2.3 → 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 * Provides a read only stream that pumps data from a PHP callable.
9 9 *
10 10 * When invoking the provided callable, the PumpStream will pass the amount of
@@ -42,9 +42,9 @@
42 42 $this->size = $options['size'] ?? null;
43 43 $this->metadata = $options['metadata'] ?? [];
44 44 $this->buffer = new BufferStream();
45 45 }
46 - public function __toString(): string
46 + public function __toString() : string
47 47 {
48 48 try {
49 49 return Utils::copyToString($this);
50 50 } catch (\Throwable $e) {
@@ -50,13 +50,13 @@
50 50 } catch (\Throwable $e) {
51 51 if (\PHP_VERSION_ID >= 70400) {
52 52 throw $e;
53 53 }
54 - trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
54 + \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
55 55 return '';
56 56 }
57 57 }
58 - public function close(): void
58 + public function close() : void
59 59 {
60 60 $this->detach();
61 61 }
62 62 public function detach()
@@ -64,58 +64,58 @@
64 64 $this->tellPos = 0;
65 65 $this->source = null;
66 66 return null;
67 67 }
68 - public function getSize(): ?int
68 + public function getSize() : ?int
69 69 {
70 70 return $this->size;
71 71 }
72 - public function tell(): int
72 + public function tell() : int
73 73 {
74 74 return $this->tellPos;
75 75 }
76 - public function eof(): bool
76 + public function eof() : bool
77 77 {
78 78 return $this->source === null;
79 79 }
80 - public function isSeekable(): bool
80 + public function isSeekable() : bool
81 81 {
82 82 return \false;
83 83 }
84 - public function rewind(): void
84 + public function rewind() : void
85 85 {
86 86 $this->seek(0);
87 87 }
88 - public function seek($offset, $whence = \SEEK_SET): void
88 + public function seek($offset, $whence = \SEEK_SET) : void
89 89 {
90 90 throw new \RuntimeException('Cannot seek a PumpStream');
91 91 }
92 - public function isWritable(): bool
92 + public function isWritable() : bool
93 93 {
94 94 return \false;
95 95 }
96 - public function write($string): int
96 + public function write($string) : int
97 97 {
98 98 throw new \RuntimeException('Cannot write to a PumpStream');
99 99 }
100 - public function isReadable(): bool
100 + public function isReadable() : bool
101 101 {
102 102 return \true;
103 103 }
104 - public function read($length): string
104 + public function read($length) : string
105 105 {
106 106 $data = $this->buffer->read($length);
107 - $readLen = strlen($data);
107 + $readLen = \strlen($data);
108 108 $this->tellPos += $readLen;
109 109 $remaining = $length - $readLen;
110 110 if ($remaining) {
111 111 $this->pump($remaining);
112 112 $data .= $this->buffer->read($remaining);
113 - $this->tellPos += strlen($data) - $readLen;
113 + $this->tellPos += \strlen($data) - $readLen;
114 114 }
115 115 return $data;
116 116 }
117 - public function getContents(): string
117 + public function getContents() : string
118 118 {
119 119 $result = '';
120 120 while (!$this->eof()) {
121 121 $result .= $this->read(1000000);
@@ -131,9 +131,9 @@
131 131 return $this->metadata;
132 132 }
133 133 return $this->metadata[$key] ?? null;
134 134 }
135 - private function pump(int $length): void
135 + private function pump(int $length) : void
136 136 {
137 137 if ($this->source !== null) {
138 138 do {
139 139 $data = ($this->source)($length);
@@ -141,9 +141,9 @@
141 141 $this->source = null;
142 142 return;
143 143 }
144 144 $this->buffer->write($data);
145 - $length -= strlen($data);
145 + $length -= \strlen($data);
146 146 } while ($length > 0);
147 147 }
148 148 }
149 149 }