Lines Matching refs:resource
287 public static function streamFor($resource = '', array $options = []): StreamInterface argument
289 if (is_scalar($resource)) {
291 if ($resource !== '') {
292 fwrite($stream, (string) $resource);
299 switch (gettype($resource)) {
307 if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') {
309 stream_copy_to_stream($resource, $stream);
311 $resource = $stream;
314 return new Stream($resource, $options);
317 if ($resource instanceof StreamInterface) {
318 return $resource;
319 } elseif ($resource instanceof \Iterator) {
320 return new PumpStream(function () use ($resource) {
321 if (!$resource->valid()) {
324 $result = $resource->current();
325 $resource->next();
329 } elseif (method_exists($resource, '__toString')) {
330 return self::streamFor((string) $resource, $options);
337 if (is_callable($resource)) {
338 return new PumpStream($resource, $options);
341 throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource));