2declare(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);
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.