43 lines
937 B
PHP
43 lines
937 B
PHP
<?php
|
|
/**
|
|
* @author Georg Ehrke
|
|
* @copyright 2014 Georg Ehrke <georg@ownCloud.com>
|
|
*
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
* later.
|
|
* See the COPYING-README file.
|
|
*/
|
|
namespace OCP\AppFramework\Http;
|
|
|
|
class DataDownloadResponse extends DownloadResponse {
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $data;
|
|
|
|
/**
|
|
* Creates a response that prompts the user to download the text
|
|
* @param string $data text to be downloaded
|
|
* @param string $filename the name that the downloaded file should have
|
|
* @param string $contentType the mimetype that the downloaded file should have
|
|
*/
|
|
public function __construct($data, $filename, $contentType) {
|
|
$this->data = $data;
|
|
parent::__construct($filename, $contentType);
|
|
}
|
|
|
|
/**
|
|
* @param string $data
|
|
*/
|
|
public function setData($data) {
|
|
$this->data = $data;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function render() {
|
|
return $this->data;
|
|
}
|
|
}
|