1 | <?php |
||
8 | class SendMessageRequest extends OrtcRequest |
||
9 | { |
||
10 | /** |
||
11 | * authentication token. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | private $authToken; |
||
16 | |||
17 | /** |
||
18 | * channel name. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | private $channelName; |
||
23 | |||
24 | /** |
||
25 | * message. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $message; |
||
30 | |||
31 | /** |
||
32 | * get url path (not base url). |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | 1 | public function getUrlPath() |
|
40 | |||
41 | /** |
||
42 | * is post request or get request? |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | 1 | public function isPost() |
|
50 | |||
51 | /** |
||
52 | * get post body. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | 1 | public function getPostData() |
|
74 | |||
75 | /** |
||
76 | * split the message into chunks. |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | 1 | protected function makeChunks() |
|
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | 2 | public function getMessage() |
|
112 | |||
113 | /** |
||
114 | * @param string $message |
||
115 | * |
||
116 | * @return $this |
||
117 | */ |
||
118 | 2 | public function setMessage($message) |
|
124 | |||
125 | /** |
||
126 | * @return string |
||
127 | */ |
||
128 | 2 | public function getAuthToken() |
|
132 | |||
133 | /** |
||
134 | * @param string $authToken |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | 2 | public function setAuthToken($authToken) |
|
144 | |||
145 | /** |
||
146 | * @return string |
||
147 | */ |
||
148 | 2 | public function getChannelName() |
|
152 | |||
153 | /** |
||
154 | * @param string $channelName |
||
155 | * |
||
156 | * @return $this |
||
157 | */ |
||
158 | 2 | public function setChannelName($channelName) |
|
164 | |||
165 | /** |
||
166 | * get response handler. |
||
167 | * |
||
168 | * @return OrtcResponseHandler |
||
169 | */ |
||
170 | 1 | public function getResponseHandler() |
|
174 | } |
||
175 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: