1 | <?php |
||
21 | abstract class Entity |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $bot_name; |
||
27 | |||
28 | /** |
||
29 | * Get bot name |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | public function getBotName() |
||
37 | |||
38 | /** |
||
39 | * Entity constructor. |
||
40 | * |
||
41 | * @todo Get rid of the $bot_name, it shouldn't be here! |
||
42 | * |
||
43 | * @param $data |
||
44 | * @param string $bot_name |
||
45 | * |
||
46 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
47 | */ |
||
48 | 25 | public function __construct($data, $bot_name = '') |
|
54 | |||
55 | /** |
||
56 | * Perform to json |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 1 | public function toJson() |
|
64 | |||
65 | /** |
||
66 | * Reflect |
||
67 | * |
||
68 | * @param null $object |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | 1 | public function reflect($object = null) |
|
141 | |||
142 | /** |
||
143 | * Perform to string |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function __toString() |
||
151 | |||
152 | /** |
||
153 | * Helper to set member variables |
||
154 | * |
||
155 | * @param array $data |
||
156 | */ |
||
157 | 25 | protected function assignMemberVariables(array $data) |
|
163 | |||
164 | /** |
||
165 | * Get the list of the properties that are themselves Entities |
||
166 | * |
||
167 | * @return array |
||
168 | */ |
||
169 | 14 | protected function subEntities() |
|
173 | |||
174 | /** |
||
175 | * Perform any special entity validation |
||
176 | * |
||
177 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
178 | */ |
||
179 | 21 | protected function validate() |
|
182 | |||
183 | /** |
||
184 | * Get a property from the current Entity |
||
185 | * |
||
186 | * @param mixed $property |
||
187 | * @param mixed $default |
||
188 | * |
||
189 | * @return mixed |
||
190 | */ |
||
191 | 21 | public function getProperty($property, $default = null) |
|
199 | |||
200 | /** |
||
201 | * Return the variable for the called getter |
||
202 | * |
||
203 | * @param $method |
||
204 | * @param $args |
||
205 | * |
||
206 | * @return mixed|null |
||
207 | */ |
||
208 | 17 | public function __call($method, $args) |
|
230 | |||
231 | /** |
||
232 | * Return an array of nice objects from an array of object arrays |
||
233 | * |
||
234 | * This method is used to generate pretty object arrays |
||
235 | * mainly for PhotoSize and Entities object arrays. |
||
236 | * |
||
237 | * @param string $class |
||
238 | * @param string $property |
||
239 | * |
||
240 | * @return array |
||
241 | */ |
||
242 | 6 | protected function makePrettyObjectArray($class, $property) |
|
260 | } |
||
261 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.