Total Complexity | 10 |
Total Lines | 118 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class Message |
||
6 | { |
||
7 | const CONTENT_TYPE_AUDIO_MP4 = 'audio/mp4'; |
||
8 | const CONTENT_TYPE_TEXT_PLAIN = 'text/plain'; |
||
9 | const CONTENT_TYPE_MEDIA_IMAGE = 'media/image'; |
||
10 | const CONTENT_TYPE_CONTACT_JSON = 'contact/json'; |
||
11 | const CONTENT_TYPE_STICKER_JSON = 'sticker/json'; |
||
12 | const CONTENT_TYPE_LOCATION_JSON = 'location/json'; |
||
13 | |||
14 | /** |
||
15 | * @var Client |
||
16 | */ |
||
17 | protected $client; |
||
18 | |||
19 | /** |
||
20 | * @var string Message type |
||
21 | */ |
||
22 | protected $type; |
||
23 | |||
24 | /** |
||
25 | * @var string Message content |
||
26 | */ |
||
27 | protected $content; |
||
28 | |||
29 | /** |
||
30 | * @var integer |
||
31 | */ |
||
32 | protected $chat_id; |
||
33 | |||
34 | /** |
||
35 | * Message constructor. |
||
36 | * @param Client $client |
||
37 | */ |
||
38 | function __construct(Client $client) |
||
39 | { |
||
40 | $this->client = $client; |
||
41 | |||
42 | $this->setType(self::CONTENT_TYPE_TEXT_PLAIN); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param $chat_id |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function to($chat_id) |
||
50 | { |
||
51 | $this->setChatId($chat_id); |
||
52 | |||
53 | return $this; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param $chat_id |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function setChatId($chat_id) |
||
61 | { |
||
62 | $this->chat_id = $chat_id; |
||
63 | |||
64 | return $this; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return int |
||
69 | */ |
||
70 | public function getChatId() |
||
71 | { |
||
72 | return $this->chat_id; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @param $type |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function setType($type) |
||
80 | { |
||
81 | $this->type = $type; |
||
82 | |||
83 | return $this; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getType() |
||
90 | { |
||
91 | return $this->type; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * @param $content |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function setContent($content) |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getContent() |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * @param null $content |
||
|
|||
115 | * @return mixed |
||
116 | */ |
||
117 | public function send($content = null) |
||
123 | } |
||
124 | } |
||
125 |