mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-21 06:56:57 +00:00
26 lines
671 B
PHP
26 lines
671 B
PHP
<?php
|
|
|
|
namespace Http\Factory\Guzzle;
|
|
|
|
use GuzzleHttp\Psr7\Stream;
|
|
use GuzzleHttp\Psr7\Utils;
|
|
use Psr\Http\Message\StreamFactoryInterface;
|
|
use Psr\Http\Message\StreamInterface;
|
|
|
|
class StreamFactory implements StreamFactoryInterface
|
|
{
|
|
public function createStream(string $content = ''): StreamInterface
|
|
{
|
|
return Utils::streamFor($content);
|
|
}
|
|
|
|
public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface
|
|
{
|
|
return $this->createStreamFromResource(Utils::tryFopen($file, $mode));
|
|
}
|
|
|
|
public function createStreamFromResource($resource): StreamInterface
|
|
{
|
|
return new Stream($resource);
|
|
}
|
|
}
|