getSize(); } if (class_exists(DiactorosUploadedFile::class)) { return new DiactorosUploadedFile( $stream, $size, $error, $clientFilename, $clientMediaType ); } if (class_exists(NyholmUploadedFile::class)) { return new NyholmUploadedFile( $stream, $size, $error, $clientFilename, $clientMediaType ); } if (class_exists(SlimPsr7UploadedFileFactory::class)) { return (new SlimPsr7UploadedFileFactory)->createUploadedFile( $stream, $size, $error, $clientFilename, $clientMediaType ); } if (class_exists(SlimUploadedFile::class)) { $meta = $stream->getMetadata(); $file = $meta["uri"]; if ($file === "php://temp") { $file = tempnam(sys_get_temp_dir(), "factory-test"); file_put_contents($file, (string) $stream); } return new SlimUploadedFile( $file, $clientFilename, $clientMediaType, $size, $error ); } if (class_exists(GuzzleUploadedFile::class)) { return new GuzzleUploadedFile( $stream, $size, $error, $clientFilename, $clientMediaType ); } throw new \RuntimeException("No PSR-7 implementation available"); } }