createStreamFromResource($resource); } /** * {@inheritDoc} */ public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface { return new Stream($file, $mode); } /** * {@inheritDoc} */ public function createStreamFromResource($resource) : StreamInterface { if (! is_resource($resource) || 'stream' !== get_resource_type($resource)) { throw new Exception\InvalidArgumentException( 'Invalid stream provided; must be a stream resource' ); } return new Stream($resource); } }