blob: 779993725e6f48d1d9ecb217c07e2991247750ab (
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
|
<?php
namespace jobd;
class RequestMessage extends Message {
protected $requestNo;
protected $requestType;
protected $requestData;
protected $password;
/**
* Request constructor.
* @param string $request_type
* @param null|array $request_data
*/
public function __construct(string $request_type, $request_data = null)
{
parent::__construct(Message::REQUEST);
$this->requestData = $request_data;
$this->requestType = $request_type;
}
/**
* @param string $password
*/
public function setPassword(string $password)
{
$this->password = $password;
}
/**
* @param int $no
*/
public function setRequestNo(int $no)
{
$this->requestNo = $no;
}
/**
* @return string[]
*/
protected function getContent(): array
{
$request = [
'type' => $this->requestType,
'no' => $this->requestNo,
];
if (!is_null($this->requestData))
$request['data'] = $this->requestData;
if (!is_null($this->password))
$request['password'] = $this->password;
return $request;
}
}
|