diff options
author | Wolfy-J <[email protected]> | 2020-10-26 21:02:56 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2020-10-26 21:02:56 +0300 |
commit | 2d3349eee632e7357ed1eb6905444194a28a4ec0 (patch) | |
tree | 74e15277ffe8c11a24e3d3b1a30edfd9597ef984 /src/Diactoros/StreamFactory.php | |
parent | 91cf918b30938129609323ded53e190385e019a6 (diff) |
- working on new cmd and logger setup
Diffstat (limited to 'src/Diactoros/StreamFactory.php')
-rwxr-xr-x | src/Diactoros/StreamFactory.php | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/Diactoros/StreamFactory.php b/src/Diactoros/StreamFactory.php deleted file mode 100755 index cc0a5306..00000000 --- a/src/Diactoros/StreamFactory.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/** - * High-performance PHP process supervisor and load balancer written in Go - * - * @author Wolfy-J - */ -declare(strict_types=1); - -namespace Spiral\RoadRunner\Diactoros; - -use RuntimeException; -use Psr\Http\Message\StreamFactoryInterface; -use Psr\Http\Message\StreamInterface; -use Zend\Diactoros\Stream; - -final class StreamFactory implements StreamFactoryInterface -{ - /** - * @inheritdoc - * @throws RuntimeException - */ - public function createStream(string $content = ''): StreamInterface - { - $resource = fopen('php://temp', 'rb+'); - - if (! \is_resource($resource)) { - throw new RuntimeException('Cannot create stream'); - } - - fwrite($resource, $content); - rewind($resource); - return $this->createStreamFromResource($resource); - } - - /** - * @inheritdoc - */ - public function createStreamFromFile(string $file, string $mode = 'rb'): StreamInterface - { - $resource = fopen($file, $mode); - - if (! \is_resource($resource)) { - throw new RuntimeException('Cannot create stream'); - } - - return $this->createStreamFromResource($resource); - } - - /** - * @inheritdoc - */ - public function createStreamFromResource($resource): StreamInterface - { - return new Stream($resource); - } -} |