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/google/cloud-storage/src/ReadStream.php +9 -9 1.0.1 → 1.4.2 View file →
@@ -14,12 +14,12 @@
14 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 15 * See the License for the specific language governing permissions and
16 16 * limitations under the License.
17 17 */
18 -namespace Dudlewebs\WPMCS\Google\Cloud\Storage;
18 +namespace Dudlewebs\WPMCS\GCP\Google\Cloud\Storage;
19 19
20 -use Dudlewebs\WPMCS\GuzzleHttp\Psr7\StreamDecoratorTrait;
21 -use Dudlewebs\WPMCS\Psr\Http\Message\StreamInterface;
20 +use Dudlewebs\WPMCS\GCP\GuzzleHttp\Psr7\StreamDecoratorTrait;
21 +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\StreamInterface;
22 22 /**
23 23 * A Stream implementation that wraps a GuzzleHttp download stream to
24 24 * provide `getSize()` from the response headers.
25 25 */
@@ -42,9 +42,9 @@
42 42 * response header.
43 43 *
44 44 * @return int The size of the stream.
45 45 */
46 - public function getSize(): ?int
46 + public function getSize() : ?int
47 47 {
48 48 return $this->stream->getSize() ?: $this->getSizeFromMetadata();
49 49 }
50 50 /**
@@ -52,13 +52,13 @@
52 52 * If we cannot, return 0.
53 53 *
54 54 * @return int The Size of the stream
55 55 */
56 - private function getSizeFromMetadata(): int
56 + private function getSizeFromMetadata() : int
57 57 {
58 58 foreach ($this->stream->getMetadata('wrapper_data') as $value) {
59 - if (substr($value, 0, 15) == "Content-Length:") {
60 - return (int) substr($value, 16);
59 + if (\substr($value, 0, 15) == 'Content-Length:') {
60 + return (int) \substr($value, 16);
61 61 }
62 62 }
63 63 return 0;
64 64 }
@@ -71,15 +71,15 @@
71 71 *
72 72 * @param int $length The number of bytes to read.
73 73 * @return string Read bytes from the underlying stream.
74 74 */
75 - public function read($length): string
75 + public function read($length) : string
76 76 {
77 77 $data = '';
78 78 do {
79 79 $moreData = $this->stream->read($length);
80 80 $data .= $moreData;
81 - $readLength = strlen($moreData);
81 + $readLength = \strlen($moreData);
82 82 $length -= $readLength;
83 83 } while ($length > 0 && $readLength > 0);
84 84 return $data;
85 85 }