1 | <?php |
||
13 | class PsrResponseFactory implements ResponseFactoryInterface, Flysystem2ResponseFactoryInterface |
||
14 | { |
||
15 | /** |
||
16 | * Base response object. |
||
17 | * @var ResponseInterface |
||
18 | */ |
||
19 | protected $response; |
||
20 | |||
21 | /** |
||
22 | * Callback to create stream. |
||
23 | * @var Closure |
||
24 | */ |
||
25 | protected $streamCallback; |
||
26 | |||
27 | /** |
||
28 | * Create PsrResponseFactory instance. |
||
29 | * @param ResponseInterface $response Base response object. |
||
30 | * @param Closure $streamCallback Callback to create stream. |
||
31 | */ |
||
32 | public function __construct(ResponseInterface $response, Closure $streamCallback) |
||
37 | |||
38 | /** |
||
39 | * Build response object |
||
40 | * @param StreamInterface $stream |
||
41 | * @param string $contentType |
||
42 | * @param string $contentLength |
||
43 | * @return ResponseInterface Response object. |
||
44 | * @throws FilesystemException |
||
45 | */ |
||
46 | private function createResponse($stream, $contentType, $contentLength) |
||
65 | |||
66 | /** |
||
67 | * Create response. |
||
68 | * @param FilesystemInterface $cache Cache file system. |
||
69 | * @param string $path Cached file path. |
||
70 | * @return ResponseInterface Response object. |
||
71 | * @throws FilesystemException |
||
72 | */ |
||
73 | public function create(FilesystemInterface $cache, $path) |
||
84 | |||
85 | /** |
||
86 | * Create response. |
||
87 | * @param FilesystemOperator $cache Cache file system. |
||
88 | * @param string $path Cached file path. |
||
89 | * @return ResponseInterface Response object. |
||
90 | * @throws FilesystemException |
||
91 | */ |
||
92 | public function createFlysystem2(FilesystemOperator $cache, $path) |
||
107 | } |
||
108 |