UploadFileResult::getBlobId()   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 0
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 UploadFileResult extends Result {
11
	/**
12
	 * @var string
13
	 */
14
	private $blobId;
15
16
	/**
17
	 * @param string $blobId
18
	 */
19
	protected function processResponse($blobId) {
20
		$this->blobId = (string)$blobId;
21
	}
22
23
	/**
24
	 * the generated blob id
25
	 *
26
	 * @return string
27
	 */
28
	public function getBlobId() {
29
		return $this->blobId;
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 or file is empty';
40
			case 402:
41
				return 'No credits remain';
42
			case 413:
43
				return 'File is too long';
44
			case 500:
45
				return 'A temporary internal server error has occurred';
46
			default:
47
				return 'Unknown error';
48
		}
49
	}
50
}
51