1 | <?php |
||
19 | abstract class AbstractEntityEvent implements EventInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var Processor $processor |
||
23 | */ |
||
24 | protected $processor; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $params; |
||
30 | |||
31 | /** |
||
32 | * @var EntityInterface $entity |
||
33 | */ |
||
34 | protected $entity = null; |
||
35 | |||
36 | /** |
||
37 | * Abstract method of each entity event which will be called if certain entity presents in response |
||
38 | * and it's class exists or mapped in the config. |
||
39 | * |
||
40 | * @return null|bool |
||
41 | */ |
||
42 | abstract public function run(); |
||
43 | |||
44 | /** |
||
45 | * Sets configuration parameters |
||
46 | * |
||
47 | * @param array $params |
||
48 | * |
||
49 | * @return $this |
||
50 | */ |
||
51 | public function setParams(array $params) |
||
57 | |||
58 | /** |
||
59 | * Returns chat id if the type of calling entity or it's parent is Message |
||
60 | * |
||
61 | * @return null|int |
||
62 | */ |
||
63 | public function getChatId() |
||
77 | |||
78 | /** |
||
79 | * @param Processor $processor |
||
80 | * |
||
81 | * @return $this |
||
82 | */ |
||
83 | public function setProcessor(Processor $processor) |
||
89 | |||
90 | /** |
||
91 | * Sets entity |
||
92 | * |
||
93 | * @param EntityInterface $entity Entity object |
||
94 | * |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function setEntity(EntityInterface $entity) |
||
103 | |||
104 | /** |
||
105 | * Sends text message to current chat |
||
106 | * |
||
107 | * @param string $text Message text |
||
108 | * |
||
109 | * @return bool|\Teebot\Api\Response |
||
110 | */ |
||
111 | protected function sendMessage($text) |
||
118 | |||
119 | /** |
||
120 | * Replies on the message |
||
121 | * |
||
122 | * @param SendMessage $sendMessage Object of the SendMessage method |
||
123 | * |
||
124 | * @return bool|\Teebot\Api\Response |
||
125 | */ |
||
126 | protected function reply(SendMessage $sendMessage) { |
||
137 | } |
||
138 |