Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Response.php
Go to the documentation of this file.
1 <?php
7 
9 use Magento\Framework\App\Request\Http as HttpRequest;
12 
13 class Response extends Http implements
16 {
20  protected $_transferAdapter;
21 
27  protected $_filePath;
28 
39  public function __construct(
40  HttpRequest $request,
43  \Magento\Framework\App\Http\Context $context,
44  \Magento\Framework\Stdlib\DateTime $dateTime,
45  \Magento\Framework\File\Transfer\Adapter\Http $transferAdapter
46  ) {
48  $this->_transferAdapter = $transferAdapter;
49  }
50 
56  public function sendResponse()
57  {
58  if ($this->_filePath && $this->getHttpResponseCode() == 200) {
59  $options = [
60  'filepath' => $this->_filePath,
61  'headers' => $this->getHeaders(),
62  ];
63  $this->_transferAdapter->send($options);
64  } else {
65  parent::sendResponse();
66  }
67  }
68 
73  public function setFilePath($path)
74  {
75  $this->_filePath = $path;
76  }
77 }
__construct(HttpRequest $request, CookieManagerInterface $cookieManager, CookieMetadataFactory $cookieMetadataFactory, \Magento\Framework\App\Http\Context $context, \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\File\Transfer\Adapter\Http $transferAdapter)
Definition: Response.php:39