This commit is contained in:
2023-10-17 21:03:47 +08:00
parent bee4a82bdf
commit d90a579272
+10 -3
View File
@@ -8,9 +8,16 @@ use Psr\Http\Message\StreamInterface;
class Stream implements StreamInterface
{
public string $content = '';
/**
* @var resource|string
*/
public mixed $content = '';
/**
* @var int
*/
public int $size = 0;
@@ -178,10 +185,10 @@ class Stream implements StreamInterface
// TODO: Implement write() method.
if (is_resource($this->content)) {
$this->content = fopen($string, 'wr');
$this->size = filesize($string);
// $this->size = filesize($string);
} else {
$this->content = $string;
$this->size = mb_strlen($string);
// $this->size = mb_strlen($string);
}
return $this->size;
}