DownloadFileResult::processResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * @author Threema GmbH
4
 * @copyright Copyright (c) 2015-2016 Threema GmbH
5
 */
6
7
8
namespace Threema\MsgApi\Commands\Results;
9
10
class DownloadFileResult extends Result {
11
	/**
12
	 * @var string
13
	 */
14
	private $data;
15
16
	/**
17
	 * @param string $data
18
	 */
19
	protected function processResponse($data) {
20
		$this->data = $data;
21
	}
22
23
	/**
24
	 * the generated blob id
25
	 *
26
	 * @return string
27
	 */
28
	public function getData() {
29
		return $this->data;
30
	}
31
32
	/**
33
	 * @param int $httpCode
34
	 * @return string
35
	 */
36
	protected function getErrorMessageByErrorCode($httpCode) {
37
		switch($httpCode) {
38
			case 401:
39
				return 'API identity or secret incorrect';
40
			case 404:
41
				return 'Invalid blob id';
42
			case 500:
43
				return 'A temporary internal server error has occurred';
44
			default:
45
				return 'Unknown error';
46
		}
47
	}
48
}
49
50