- Added createStream methods and fixed multiple errors views
This commit is contained in:
1 parent
74a56bd72f
commit
fdca37a79d
9 files changed
+17
-19
No files matched your search
@@ -34,7 +34,7 @@ class NotFoundDecorator implements NotFoundDecoratorInterface
|
||||
return $this->throw404($request);
|
||||
}
|
||||
|
||||
return $handler->handle($request);;
|
||||
return $handler->handle($request);
|
||||
}
|
||||
|
||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, Redir
|
||||
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
|
||||
use Laminas\Diactoros\Response;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
interface HttpFactoryInterface
|
||||
{
|
||||
@@ -19,4 +20,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;
|
||||
}
|
||||
Reference in new issue
Block a user