Code Duplication    Length = 5-6 lines in 3 locations

lib/controller/addressbookcontroller.php 2 locations

@@ 84-89 (lines=6) @@
81
		$response = new JSONResponse();
82
		$response->setData(array('data' => $addressBook->getMetaData()));
83
84
		if (!is_null($lastModified)) {
85
			$response->addHeader('Cache-Control', 'private, must-revalidate');
86
			$response->setLastModified(\DateTime::createFromFormat('U', $lastModified) ?: null);
87
			$etag = md5($lastModified);
88
			$response->setETag($etag);
89
		}
90
91
		return $response;
92
	}
@@ 106-111 (lines=6) @@
103
		$etag = null;
104
		$response = new JSONResponse();
105
106
		if (!is_null($lastModified)) {
107
			//$response->addHeader('Cache-Control', 'private, must-revalidate');
108
			$response->setLastModified(\DateTime::createFromFormat('U', $lastModified) ?: null);
109
			$etag = md5($lastModified);
110
			$response->setETag($etag);
111
		}
112
113
		if (!is_null($etag)
114
			&& $this->request->getHeader('If-None-Match') === '"'.$etag.'"')

lib/controller/exportcontroller.php 1 location

@@ 43-47 (lines=5) @@
40
		}
41
		$name = str_replace(' ', '_', $addressBook->getDisplayName()) . '.vcf';
42
		$response = new TextDownloadResponse($contacts, $name, 'text/directory');
43
		if(!is_null($lastModified)) {
44
			$response->addHeader('Cache-Control', 'private, must-revalidate');
45
			$response->setLastModified(\DateTime::createFromFormat('U', $lastModified) ?: null);
46
			$response->setETag(md5($lastModified));
47
		}
48
49
		return $response;
50
	}