diff options
Diffstat (limited to 'src/Diactoros/UploadedFileFactory.php')
-rw-r--r-- | src/Diactoros/UploadedFileFactory.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Diactoros/UploadedFileFactory.php b/src/Diactoros/UploadedFileFactory.php new file mode 100644 index 00000000..1543a826 --- /dev/null +++ b/src/Diactoros/UploadedFileFactory.php @@ -0,0 +1,35 @@ +<?php +declare(strict_types=1); + +/** + * High-performance PHP process supervisor and load balancer written in Go + * + * @author Wolfy-J + */ + +namespace Spiral\RoadRunner\Diactoros; + +use Psr\Http\Message\StreamInterface; +use Psr\Http\Message\UploadedFileFactoryInterface; +use Psr\Http\Message\UploadedFileInterface; +use Zend\Diactoros\UploadedFile; + +final class UploadedFileFactory implements UploadedFileFactoryInterface +{ + /** + * @inheritdoc + */ + public function createUploadedFile( + StreamInterface $stream, + int $size = null, + int $error = \UPLOAD_ERR_OK, + string $clientFilename = null, + string $clientMediaType = null + ): UploadedFileInterface { + if ($size === null) { + $size = $stream->getSize(); + } + + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } +}
\ No newline at end of file |