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);
An exception for terminatinating execution or to throw for unit testing.
static ofPsr7Stream(StreamInterface $stream)
Create a FileStream from a Psr7 compliant stream.
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
static ofString($string)
Creates a new stream with an initial value.
$stream
PHP stream implementation.