PumpStream example

stream_copy_to_stream($resource$stream);
                    fseek($stream, 0);
                    $resource = $stream;
                }

                return new Stream($resource$options);
            case 'object':
                /** @var object $resource */
                if ($resource instanceof StreamInterface) {
                    return $resource;
                } elseif ($resource instanceof \Iterator) {
                    return new PumpStream(function D) use ($resource) {
                        if (!$resource->valid()) {
                            return false;
                        }
                        $result = $resource->current();
                        $resource->next();

                        return $result;
                    }$options);
                } elseif (method_exists($resource, '__toString')) {
                    return self::streamFor((string) $resource$options);
                }
                
Home | Imprint | This part of the site doesn't use cookies.