1 | <?php |
||
14 | class SaveResponse |
||
15 | { |
||
16 | use Utils\FileTrait; |
||
17 | |||
18 | /** |
||
19 | * Execute the middleware. |
||
20 | * |
||
21 | * @param RequestInterface $request |
||
22 | * @param ResponseInterface $response |
||
23 | * @param callable $next |
||
24 | * |
||
25 | * @return ResponseInterface |
||
26 | */ |
||
27 | public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next) |
||
42 | |||
43 | /** |
||
44 | * Check whether the response can be saved or not. |
||
45 | * |
||
46 | * @param RequestInterface $request |
||
47 | * @param ResponseInterface $response |
||
48 | * |
||
49 | * @return bool |
||
50 | */ |
||
51 | private function canSave(RequestInterface $request, ResponseInterface $response) |
||
77 | |||
78 | /** |
||
79 | * Write the stream to the given path. |
||
80 | * |
||
81 | * @param StreamInterface $stream |
||
82 | * @param string $path |
||
83 | */ |
||
84 | private static function writeStream(StreamInterface $stream, $path) |
||
106 | } |
||
107 |