Conditions | 4 |
Paths | 2 |
Total Lines | 30 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | public function sendMessage($userId, $text) |
||
17 | { |
||
18 | $this->request->checkLoggedIn(); |
||
19 | |||
20 | $data = array( |
||
21 | "options" => array( |
||
22 | "user_ids" => array( |
||
23 | $userId, |
||
24 | ), |
||
25 | "emails" => array(), |
||
26 | "text" => $text, |
||
27 | ), |
||
28 | "context" => new \stdClass(), |
||
29 | ); |
||
30 | |||
31 | $dataJson = json_encode($data); |
||
32 | |||
33 | $post = array( |
||
34 | 'data' => $dataJson, |
||
35 | ); |
||
36 | |||
37 | $postString = UrlHelper::buildRequestString($post); |
||
38 | $res = $this->request->exec(UrlHelper::RESOURCE_SEND_MESSAGE, $postString); |
||
39 | |||
40 | if ($res === null || !isset($res['resource_response']) || $res['resource_response']['error'] !== null) { |
||
41 | return false; |
||
42 | } |
||
43 | |||
44 | return true; |
||
45 | } |
||
46 | } |
||
47 |