blob: 8e687e2c549113df044675dc83b3ce3148454fa7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
namespace jobd;
class ResponseMessage extends Message {
protected $requestNo;
protected $error;
protected $data;
/**
* Response constructor.
*
* @param int $requestNo
* @param null $error
* @param null $data
*/
public function __construct($request_no, $error = null, $data = null) {
parent::__construct(Message::RESPONSE);
$this->requestNo = $request_no;
$this->error = $error;
$this->data = $data;
}
/**
* @return array
*/
protected function getContent(): array {
$response = [
'no' => $this->requestNo
];
if (!is_null($this->error))
$response['error'] = $this->error;
if (!is_null(!$this->data))
$response['data'] = $this->data;
return $response;
}
/**
* @return mixed
*/
public function getError() {
return $this->error;
}
/**
* @return mixed
*/
public function getData() {
return $this->data;
}
/**
* @return int
*/
public function getRequestNo() {
return $this->requestNo;
}
}
|