Mise à jour des librairies
This commit is contained in:
39
vendor/guzzlehttp/psr7/src/Stream.php
vendored
39
vendor/guzzlehttp/psr7/src/Stream.php
vendored
@@ -24,11 +24,11 @@ class Stream implements StreamInterface
|
||||
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
|
||||
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
|
||||
'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
|
||||
'x+t' => true, 'c+t' => true, 'a+' => true
|
||||
'x+t' => true, 'c+t' => true, 'a+' => true, 'rb+' => true,
|
||||
],
|
||||
'write' => [
|
||||
'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
|
||||
'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
|
||||
'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'rb+' => true,
|
||||
'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
|
||||
'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
|
||||
]
|
||||
@@ -70,15 +70,6 @@ class Stream implements StreamInterface
|
||||
$this->uri = $this->getMetadata('uri');
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if ($name == 'stream') {
|
||||
throw new \RuntimeException('The stream is detached');
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException('No value for ' . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the stream when the destructed
|
||||
*/
|
||||
@@ -99,6 +90,10 @@ class Stream implements StreamInterface
|
||||
|
||||
public function getContents()
|
||||
{
|
||||
if (!isset($this->stream)) {
|
||||
throw new \RuntimeException('Stream is detached');
|
||||
}
|
||||
|
||||
$contents = stream_get_contents($this->stream);
|
||||
|
||||
if ($contents === false) {
|
||||
@@ -173,11 +168,19 @@ class Stream implements StreamInterface
|
||||
|
||||
public function eof()
|
||||
{
|
||||
return !$this->stream || feof($this->stream);
|
||||
if (!isset($this->stream)) {
|
||||
throw new \RuntimeException('Stream is detached');
|
||||
}
|
||||
|
||||
return feof($this->stream);
|
||||
}
|
||||
|
||||
public function tell()
|
||||
{
|
||||
if (!isset($this->stream)) {
|
||||
throw new \RuntimeException('Stream is detached');
|
||||
}
|
||||
|
||||
$result = ftell($this->stream);
|
||||
|
||||
if ($result === false) {
|
||||
@@ -194,9 +197,13 @@ class Stream implements StreamInterface
|
||||
|
||||
public function seek($offset, $whence = SEEK_SET)
|
||||
{
|
||||
if (!isset($this->stream)) {
|
||||
throw new \RuntimeException('Stream is detached');
|
||||
}
|
||||
if (!$this->seekable) {
|
||||
throw new \RuntimeException('Stream is not seekable');
|
||||
} elseif (fseek($this->stream, $offset, $whence) === -1) {
|
||||
}
|
||||
if (fseek($this->stream, $offset, $whence) === -1) {
|
||||
throw new \RuntimeException('Unable to seek to stream position '
|
||||
. $offset . ' with whence ' . var_export($whence, true));
|
||||
}
|
||||
@@ -204,6 +211,9 @@ class Stream implements StreamInterface
|
||||
|
||||
public function read($length)
|
||||
{
|
||||
if (!isset($this->stream)) {
|
||||
throw new \RuntimeException('Stream is detached');
|
||||
}
|
||||
if (!$this->readable) {
|
||||
throw new \RuntimeException('Cannot read from non-readable stream');
|
||||
}
|
||||
@@ -225,6 +235,9 @@ class Stream implements StreamInterface
|
||||
|
||||
public function write($string)
|
||||
{
|
||||
if (!isset($this->stream)) {
|
||||
throw new \RuntimeException('Stream is detached');
|
||||
}
|
||||
if (!$this->writable) {
|
||||
throw new \RuntimeException('Cannot write to a non-writable stream');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user