2 declare(strict_types=1);
32 if (!is_string($string)) {
33 throw new \InvalidArgumentException(
'The argument $string must be of type string but was "' . gettype($string) .
'"');
54 if (!is_resource($resource)) {
55 throw new \InvalidArgumentException(
'The argument $resource must be of type resource but was "' . gettype($resource) .
'"');
58 return new Stream($resource);
71 $resource = $stream->
detach();
72 return self::ofResource($resource);
detach()
Separates any underlying resources from the stream.
$stream
PHP stream implementation.
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
static ofString($string)
Creates a new stream with an initial value.
static ofPsr7Stream(StreamInterface $stream)
Create a FileStream from a Psr7 compliant stream.