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/BufferStream.php +22 -22 1.0.2 → 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 buffer stream that can be written to to fill a buffer, and read
9 9 * from to remove bytes from the buffer.
10 10 *
@@ -28,19 +28,19 @@
28 28 public function __construct(int $hwm = 16384)
29 29 {
30 30 $this->hwm = $hwm;
31 31 }
32 - public function __toString(): string
32 + public function __toString() : string
33 33 {
34 34 return $this->getContents();
35 35 }
36 - public function getContents(): string
36 + public function getContents() : string
37 37 {
38 38 $buffer = $this->buffer;
39 39 $this->buffer = '';
40 40 return $buffer;
41 41 }
42 - public function close(): void
42 + public function close() : void
43 43 {
44 44 $this->buffer = '';
45 45 }
46 46 public function detach()
@@ -47,37 +47,37 @@
47 47 {
48 48 $this->close();
49 49 return null;
50 50 }
51 - public function getSize(): ?int
51 + public function getSize() : ?int
52 52 {
53 - return strlen($this->buffer);
53 + return \strlen($this->buffer);
54 54 }
55 - public function isReadable(): bool
55 + public function isReadable() : bool
56 56 {
57 57 return \true;
58 58 }
59 - public function isWritable(): bool
59 + public function isWritable() : bool
60 60 {
61 61 return \true;
62 62 }
63 - public function isSeekable(): bool
63 + public function isSeekable() : bool
64 64 {
65 65 return \false;
66 66 }
67 - public function rewind(): void
67 + public function rewind() : void
68 68 {
69 69 $this->seek(0);
70 70 }
71 - public function seek($offset, $whence = \SEEK_SET): void
71 + public function seek($offset, $whence = \SEEK_SET) : void
72 72 {
73 73 throw new \RuntimeException('Cannot seek a BufferStream');
74 74 }
75 - public function eof(): bool
75 + public function eof() : bool
76 76 {
77 - return strlen($this->buffer) === 0;
77 + return \strlen($this->buffer) === 0;
78 78 }
79 - public function tell(): int
79 + public function tell() : int
80 80 {
81 81 throw new \RuntimeException('Cannot determine the position of a BufferStream');
82 82 }
83 83 /**
@@ -82,11 +82,11 @@
82 82 }
83 83 /**
84 84 * Reads data from the buffer.
85 85 */
86 - public function read($length): string
86 + public function read($length) : string
87 87 {
88 - $currentLength = strlen($this->buffer);
88 + $currentLength = \strlen($this->buffer);
89 89 if ($length >= $currentLength) {
90 90 // No need to slice the buffer because we don't have enough data.
91 91 $result = $this->buffer;
92 92 $this->buffer = '';
@@ -91,10 +91,10 @@
91 91 $result = $this->buffer;
92 92 $this->buffer = '';
93 93 } else {
94 94 // Slice up the result to provide a subset of the buffer.
95 - $result = substr($this->buffer, 0, $length);
96 - $this->buffer = substr($this->buffer, $length);
95 + $result = \substr($this->buffer, 0, $length);
96 + $this->buffer = \substr($this->buffer, $length);
97 97 }
98 98 return $result;
99 99 }
100 100 /**
@@ -99,15 +99,15 @@
99 99 }
100 100 /**
101 101 * Writes data to the buffer.
102 102 */
103 - public function write($string): int
103 + public function write($string) : int
104 104 {
105 105 $this->buffer .= $string;
106 - if (strlen($this->buffer) >= $this->hwm) {
106 + if (\strlen($this->buffer) >= $this->hwm) {
107 107 return 0;
108 108 }
109 - return strlen($string);
109 + return \strlen($string);
110 110 }
111 111 /**
112 112 * @return mixed
113 113 */