summaryrefslogtreecommitdiff
path: root/src/Diactoros/StreamFactory.php
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-15 14:28:30 +0300
committerValery Piashchynski <[email protected]>2020-12-15 14:28:30 +0300
commit21b51367e27f5a1b166459a115e4655d07a5d832 (patch)
treec3257a2ac38f0688e78ca2c9eeb160fb7a84c55d /src/Diactoros/StreamFactory.php
parent08f073f3bdc1288db68235c098c3a2109c6e7667 (diff)
parentd39a0735fe21d21c5aae20c4780458433a42250a (diff)
Merge branch '2.0' into plugin/reloader
# Conflicts: # go.mod # sync_worker.go
Diffstat (limited to 'src/Diactoros/StreamFactory.php')
-rw-r--r--src/Diactoros/StreamFactory.php57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/Diactoros/StreamFactory.php b/src/Diactoros/StreamFactory.php
deleted file mode 100644
index 68a77e92..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 Laminas\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);
- }
-}