changes for filter and print
This commit is contained in:
15
vendor/guzzlehttp/psr7/src/Stream.php
vendored
15
vendor/guzzlehttp/psr7/src/Stream.php
vendored
@ -12,8 +12,8 @@ use Psr\Http\Message\StreamInterface;
|
||||
class Stream implements StreamInterface
|
||||
{
|
||||
/**
|
||||
* @see http://php.net/manual/function.fopen.php
|
||||
* @see http://php.net/manual/en/function.gzopen.php
|
||||
* @see https://www.php.net/manual/en/function.fopen.php
|
||||
* @see https://www.php.net/manual/en/function.gzopen.php
|
||||
*/
|
||||
private const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
|
||||
private const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
|
||||
@ -61,8 +61,8 @@ class Stream implements StreamInterface
|
||||
$this->stream = $stream;
|
||||
$meta = stream_get_meta_data($this->stream);
|
||||
$this->seekable = $meta['seekable'];
|
||||
$this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']);
|
||||
$this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']);
|
||||
$this->readable = (bool) preg_match(self::READABLE_MODES, $meta['mode']);
|
||||
$this->writable = (bool) preg_match(self::WRITABLE_MODES, $meta['mode']);
|
||||
$this->uri = $this->getMetadata('uri');
|
||||
}
|
||||
|
||||
@ -80,12 +80,14 @@ class Stream implements StreamInterface
|
||||
if ($this->isSeekable()) {
|
||||
$this->seek(0);
|
||||
}
|
||||
|
||||
return $this->getContents();
|
||||
} catch (\Throwable $e) {
|
||||
if (\PHP_VERSION_ID >= 70400) {
|
||||
throw $e;
|
||||
}
|
||||
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -145,6 +147,7 @@ class Stream implements StreamInterface
|
||||
$stats = fstat($this->stream);
|
||||
if (is_array($stats) && isset($stats['size'])) {
|
||||
$this->size = $stats['size'];
|
||||
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
@ -207,7 +210,7 @@ class Stream implements StreamInterface
|
||||
}
|
||||
if (fseek($this->stream, $offset, $whence) === -1) {
|
||||
throw new \RuntimeException('Unable to seek to stream position '
|
||||
. $offset . ' with whence ' . var_export($whence, true));
|
||||
.$offset.' with whence '.var_export($whence, true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,8 +264,6 @@ class Stream implements StreamInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
Reference in New Issue
Block a user