Skip to content

Commit 81a20f1

Browse files
authored
Update ResponseFactory.php
1 parent 1db476a commit 81a20f1

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/Tqdev/PhpCrudApi/ResponseFactory.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,7 @@ public static function fromObject(int $status, $body): ResponseInterface
3737
return self::from($status, 'application/json', $content);
3838
}
3939

40-
public static function fromFile(int $status, string $filename): ResponseInterface
41-
{
42-
$psr17Factory = new Psr17Factory();
43-
$response = $psr17Factory->createResponse($status);
44-
$stream = $psr17Factory->createStreamFromFile($filename);
45-
$response = $response->withBody($stream);
46-
$response = $response->withHeader('Content-Type', mime_content_type(basename($filename)));
47-
$response = $response->withHeader('Content-Length', filesize($filename));
48-
return $response;
49-
}
50-
51-
private static function from(int $status, string $contentType, string $content): ResponseInterface
40+
public static function from(int $status, string $contentType, string $content): ResponseInterface
5241
{
5342
$psr17Factory = new Psr17Factory();
5443
$response = $psr17Factory->createResponse($status);

0 commit comments

Comments
 (0)