ExportResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A render() 0 3 1
1
<?php
2
3
namespace OCA\Bookmarks\Controller\Lib;
4
5
use OCP\AppFramework\Http\Response;
6
7
class ExportResponse extends Response {
8
9
	private $returnstring;
10
11
	public function __construct($returnstring) {
12
		$user_name = trim(\OCP\User::getDisplayName()) != '' ?
13
				\OCP\User::getDisplayName() : \OCP\User::getUser();
14
		$export_name = '"ownCloud Bookmarks (' . $user_name . ') (' . date('Y-m-d') . ').html"';
15
		$this->addHeader("Cache-Control", "private");
16
		$this->addHeader("Content-Type", " application/stream");
17
		$this->addHeader("Content-Length", strlen($returnstring));
18
		$this->addHeader("Content-Disposition", "attachment; filename=" . $export_name);
19
		$this->returnstring = $returnstring;
20
	}
21
22
	public function render() {
23
		return $this->returnstring;
24
	}
25
26
}