ReceiveMessageResult::getFiles()   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\Helpers;
9
10
use Threema\MsgApi\Messages\ThreemaMessage;
11
12
class ReceiveMessageResult {
13
	/**
14
	 * @var ThreemaMessage
15
	 */
16
	private $threemaMessage;
17
18
	/**
19
	 * @var string[]
20
	 */
21
	private $files = array();
22
23
	/**
24
	 * @var string[]
25
	 */
26
	private $errors = array();
27
28
	/**
29
	 * @var string
30
	 */
31
	private $messageId;
32
33
	/**
34
	 * @param string $messageId
35
	 * @param ThreemaMessage $threemaMessage
36
	 */
37
	public function __construct($messageId, ThreemaMessage $threemaMessage) {
38
		$this->threemaMessage = $threemaMessage;
39
		$this->messageId = $messageId;
40
	}
41
42
	/**
43
	 * @return string
44
	 */
45
	public function getMessageId() {
46
		return $this->messageId;
47
	}
48
49
	/**
50
	 * @param $message
51
	 * @return $this
52
	 */
53
	public function addError($message) {
54
		$this->errors[] = $message;
55
		return $this;
56
	}
57
58
	/**
59
	 * @return bool
60
	 */
61
	public function isSuccess() {
62
		return null === $this->errors || count($this->errors) == 0;
63
	}
64
65
	/**
66
	 * @param string $key
67
	 * @param string $file
68
	 * @return $this
69
	 */
70
	public function addFile($key, $file) {
71
		$this->files[$key] = $file;
72
		return $this;
73
	}
74
75
	/**
76
	 * @return \string[]
77
	 */
78
	public function getErrors() {
79
		return $this->errors;
80
	}
81
82
	/**
83
	 * @return ThreemaMessage
84
	 */
85
	public function getThreemaMessage() {
86
		return $this->threemaMessage;
87
	}
88
89
	/**
90
	 * @return \string[]
91
	 */
92
	public function getFiles() {
93
		return $this->files;
94
	}
95
}
96