- Added createStream methods and fixed multiple errors views

This commit is contained in:
mcndave authored and Dave Mc Nicoll committed 2026-02-25 19:40:58 +00:00
1 parent ca388e8a52
commit d74c916558
8 files changed
+20 -18

No files matched your search

+7
View File
@@ -5,7 +5,9 @@ namespace Lean\Factory;
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
use Laminas\Diactoros\Response;
use Laminas\Diactoros\StreamFactory;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
class HttpFactory implements HttpFactoryInterface
{
@@ -58,4 +60,9 @@ class HttpFactory implements HttpFactoryInterface
{
return new FileDownloadResponse($path, $code, $headers);
}
public static function createStream(string $content): StreamInterface
{
return new StreamFactory()->createStream($content);
}
}
+3
View File
@@ -3,6 +3,7 @@
namespace Lean\Factory;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
interface HttpFactoryInterface
{
@@ -16,4 +17,6 @@ interface HttpFactoryInterface
public static function createDownloadableResponse(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface;
public static function createImageResponse(string $data, int $code = 200, array $headers = []) : ResponseInterface;
public static function createFileDownloadResponse(string $path, int $code = 200, array $headers = []) : ResponseInterface;
public static function createStream(string $content) : StreamInterface;
}