31 if (!is_string($string)) {
32 throw new \InvalidArgumentException(
'The argument $string must be of type string but was "' . gettype($string) .
'"');
53 if (!is_resource($resource)) {
54 throw new \InvalidArgumentException(
'The argument $resource must be of type resource but was "' . gettype($resource) .
'"');
57 return new Stream($resource);
70 $resource = $stream->
detach();
71 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.