| 1 | <?php |
||
| 13 | |||
| 14 | class SendSimple implements CommandInterface { |
||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $text; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var \Threema\MsgApi\Receiver |
||
| 22 | */ |
||
| 23 | private $receiver; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param \Threema\MsgApi\Receiver $receiver |
||
| 27 | * @param string $text |
||
| 28 | */ |
||
| 29 | public function __construct(Receiver $receiver, $text) { |
||
| 30 | $this->text = $text; |
||
| 31 | $this->receiver = $receiver; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | public public function getText() { |
||
|
|
|||
| 38 | return $this->text; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | public function getParams() { |
||
| 45 | $p = $this->receiver->getParams(); |
||
| 46 | $p['text'] = $this->getText(); |
||
| 47 | return $p; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function getPath() { |
||
| 54 | return 'send_simple'; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param int $httpCode |
||
| 59 | * @param object $res |
||
| 60 | * @return SendSimpleResult |
||
| 61 | */ |
||
| 62 | public function parseResult($httpCode, $res){ |
||
| 63 | return new SendSimpleResult($httpCode, $res); |
||
| 64 | } |
||
| 65 | } |
||
| 66 |