Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function __construct($content, $fileName, $contentType, $contentDisposition = 'attachment', $status = 200, $headers = []) |
||
11 | { |
||
12 | $contentDispositionDirectives = [ResponseHeaderBag::DISPOSITION_INLINE, ResponseHeaderBag::DISPOSITION_ATTACHMENT]; |
||
13 | if (!in_array($contentDisposition, $contentDispositionDirectives)) { |
||
14 | throw new \InvalidArgumentException(sprintf('Expected one of the following directives: "%s", but "%s" given.', implode('", "', $contentDispositionDirectives), $contentDisposition)); |
||
15 | } |
||
16 | |||
17 | parent::__construct($content, $status, $headers); |
||
18 | $this->headers->add(['Content-Type' => $contentType]); |
||
19 | $this->headers->add(['Content-Disposition' => $this->headers->makeDisposition($contentDisposition, $fileName)]); |
||
20 | } |
||
21 | } |
||
22 |