@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function run() |
140 | 140 | { |
141 | 141 | if ($data = BotApi::jsonValidate($this->getRawBody(), true)) { |
142 | - $this->handle([Update::fromResponse($data)]); |
|
142 | + $this->handle([ Update::fromResponse($data) ]); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected static function getEvent(Closure $action) |
159 | 159 | { |
160 | - return function (Update $update) use ($action) { |
|
160 | + return function(Update $update) use ($action) { |
|
161 | 161 | $message = $update->getMessage(); |
162 | 162 | if (!$message) { |
163 | 163 | return true; |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | |
166 | 166 | preg_match(self::REGEXP, $message->getText(), $matches); |
167 | 167 | |
168 | - if (isset($matches[3]) && !empty($matches[3])) { |
|
169 | - $parameters = str_getcsv($matches[3], chr(32)); |
|
168 | + if (isset($matches[ 3 ]) && !empty($matches[ 3 ])) { |
|
169 | + $parameters = str_getcsv($matches[ 3 ], chr(32)); |
|
170 | 170 | } else { |
171 | - $parameters = []; |
|
171 | + $parameters = [ ]; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | array_unshift($parameters, $message); |
@@ -185,104 +185,104 @@ discard block |
||
185 | 185 | |
186 | 186 | protected static function getEditedMessageEvent(Closure $action) |
187 | 187 | { |
188 | - return function (Update $update) use ($action) { |
|
188 | + return function(Update $update) use ($action) { |
|
189 | 189 | if (!$update->getEditedMessage()) { |
190 | 190 | return true; |
191 | 191 | } |
192 | 192 | |
193 | 193 | $reflectionAction = new ReflectionFunction($action); |
194 | - $reflectionAction->invokeArgs([$update->getEditedMessage()]); |
|
194 | + $reflectionAction->invokeArgs([ $update->getEditedMessage() ]); |
|
195 | 195 | return false; |
196 | 196 | }; |
197 | 197 | } |
198 | 198 | |
199 | 199 | protected static function getChannelPostEvent(Closure $action) |
200 | 200 | { |
201 | - return function (Update $update) use ($action) { |
|
201 | + return function(Update $update) use ($action) { |
|
202 | 202 | if (!$update->getChannelPost()) { |
203 | 203 | return true; |
204 | 204 | } |
205 | 205 | |
206 | 206 | $reflectionAction = new ReflectionFunction($action); |
207 | - $reflectionAction->invokeArgs([$update->getChannelPost()]); |
|
207 | + $reflectionAction->invokeArgs([ $update->getChannelPost() ]); |
|
208 | 208 | return false; |
209 | 209 | }; |
210 | 210 | } |
211 | 211 | |
212 | 212 | protected static function getCallbackQueryEvent(Closure $action) |
213 | 213 | { |
214 | - return function (Update $update) use ($action) { |
|
214 | + return function(Update $update) use ($action) { |
|
215 | 215 | if (!$update->getCallbackQuery()) { |
216 | 216 | return true; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $reflectionAction = new ReflectionFunction($action); |
220 | - $reflectionAction->invokeArgs([$update->getCallbackQuery()]); |
|
220 | + $reflectionAction->invokeArgs([ $update->getCallbackQuery() ]); |
|
221 | 221 | return false; |
222 | 222 | }; |
223 | 223 | } |
224 | 224 | |
225 | 225 | protected static function getEditedChannelPostEvent(Closure $action) |
226 | 226 | { |
227 | - return function (Update $update) use ($action) { |
|
227 | + return function(Update $update) use ($action) { |
|
228 | 228 | if (!$update->getEditedChannelPost()) { |
229 | 229 | return true; |
230 | 230 | } |
231 | 231 | |
232 | 232 | $reflectionAction = new ReflectionFunction($action); |
233 | - $reflectionAction->invokeArgs([$update->getEditedChannelPost()]); |
|
233 | + $reflectionAction->invokeArgs([ $update->getEditedChannelPost() ]); |
|
234 | 234 | return false; |
235 | 235 | }; |
236 | 236 | } |
237 | 237 | |
238 | 238 | protected static function getInlineQueryEvent(Closure $action) |
239 | 239 | { |
240 | - return function (Update $update) use ($action) { |
|
240 | + return function(Update $update) use ($action) { |
|
241 | 241 | if (!$update->getInlineQuery()) { |
242 | 242 | return true; |
243 | 243 | } |
244 | 244 | |
245 | 245 | $reflectionAction = new ReflectionFunction($action); |
246 | - $reflectionAction->invokeArgs([$update->getInlineQuery()]); |
|
246 | + $reflectionAction->invokeArgs([ $update->getInlineQuery() ]); |
|
247 | 247 | return false; |
248 | 248 | }; |
249 | 249 | } |
250 | 250 | |
251 | 251 | protected static function getChosenInlineResultEvent(Closure $action) |
252 | 252 | { |
253 | - return function (Update $update) use ($action) { |
|
253 | + return function(Update $update) use ($action) { |
|
254 | 254 | if (!$update->getChosenInlineResult()) { |
255 | 255 | return true; |
256 | 256 | } |
257 | 257 | |
258 | 258 | $reflectionAction = new ReflectionFunction($action); |
259 | - $reflectionAction->invokeArgs([$update->getChosenInlineResult()]); |
|
259 | + $reflectionAction->invokeArgs([ $update->getChosenInlineResult() ]); |
|
260 | 260 | return false; |
261 | 261 | }; |
262 | 262 | } |
263 | 263 | |
264 | 264 | protected static function getShippingQueryEvent(Closure $action) |
265 | 265 | { |
266 | - return function (Update $update) use ($action) { |
|
266 | + return function(Update $update) use ($action) { |
|
267 | 267 | if (!$update->getShippingQuery()) { |
268 | 268 | return true; |
269 | 269 | } |
270 | 270 | |
271 | 271 | $reflectionAction = new ReflectionFunction($action); |
272 | - $reflectionAction->invokeArgs([$update->getShippingQuery()]); |
|
272 | + $reflectionAction->invokeArgs([ $update->getShippingQuery() ]); |
|
273 | 273 | return false; |
274 | 274 | }; |
275 | 275 | } |
276 | 276 | |
277 | 277 | protected static function getPreCheckoutQueryEvent(Closure $action) |
278 | 278 | { |
279 | - return function (Update $update) use ($action) { |
|
279 | + return function(Update $update) use ($action) { |
|
280 | 280 | if (!$update->getPreCheckoutQuery()) { |
281 | 281 | return true; |
282 | 282 | } |
283 | 283 | |
284 | 284 | $reflectionAction = new ReflectionFunction($action); |
285 | - $reflectionAction->invokeArgs([$update->getPreCheckoutQuery()]); |
|
285 | + $reflectionAction->invokeArgs([ $update->getPreCheckoutQuery() ]); |
|
286 | 286 | return false; |
287 | 287 | }; |
288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | protected static function getChecker($name) |
298 | 298 | { |
299 | - return function (Update $update) use ($name) { |
|
299 | + return function(Update $update) use ($name) { |
|
300 | 300 | $message = $update->getMessage(); |
301 | 301 | if (is_null($message) || !strlen($message->getText())) { |
302 | 302 | return false; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | preg_match(self::REGEXP, $message->getText(), $matches); |
306 | 306 | |
307 | - return !empty($matches) && $matches[1] == $name; |
|
307 | + return !empty($matches) && $matches[ 1 ] == $name; |
|
308 | 308 | }; |
309 | 309 | } |
310 | 310 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | protected static function getEditedMessageChecker() |
317 | 317 | { |
318 | - return function (Update $update) { |
|
318 | + return function(Update $update) { |
|
319 | 319 | return !is_null($update->getEditedMessage()); |
320 | 320 | }; |
321 | 321 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected static function getChannelPostChecker() |
329 | 329 | { |
330 | - return function (Update $update) { |
|
330 | + return function(Update $update) { |
|
331 | 331 | return !is_null($update->getChannelPost()); |
332 | 332 | }; |
333 | 333 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | protected static function getCallbackQueryChecker() |
341 | 341 | { |
342 | - return function (Update $update) { |
|
342 | + return function(Update $update) { |
|
343 | 343 | return !is_null($update->getCallbackQuery()); |
344 | 344 | }; |
345 | 345 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | protected static function getEditedChannelPostChecker() |
353 | 353 | { |
354 | - return function (Update $update) { |
|
354 | + return function(Update $update) { |
|
355 | 355 | return !is_null($update->getEditedChannelPost()); |
356 | 356 | }; |
357 | 357 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | protected static function getChosenInlineResultChecker() |
365 | 365 | { |
366 | - return function (Update $update) { |
|
366 | + return function(Update $update) { |
|
367 | 367 | return !is_null($update->getChosenInlineResult()); |
368 | 368 | }; |
369 | 369 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected static function getInlineQueryChecker() |
377 | 377 | { |
378 | - return function (Update $update) { |
|
378 | + return function(Update $update) { |
|
379 | 379 | return !is_null($update->getInlineQuery()); |
380 | 380 | }; |
381 | 381 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | protected static function getShippingQueryChecker() |
389 | 389 | { |
390 | - return function (Update $update) { |
|
390 | + return function(Update $update) { |
|
391 | 391 | return !is_null($update->getShippingQuery()); |
392 | 392 | }; |
393 | 393 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | */ |
400 | 400 | protected static function getPreCheckoutQueryChecker() |
401 | 401 | { |
402 | - return function (Update $update) { |
|
402 | + return function(Update $update) { |
|
403 | 403 | return !is_null($update->getPreCheckoutQuery()); |
404 | 404 | }; |
405 | 405 | } |
@@ -407,9 +407,9 @@ discard block |
||
407 | 407 | public function __call($name, array $arguments) |
408 | 408 | { |
409 | 409 | if (method_exists($this, $name)) { |
410 | - return call_user_func_array([$this, $name], $arguments); |
|
410 | + return call_user_func_array([ $this, $name ], $arguments); |
|
411 | 411 | } elseif (method_exists($this->api, $name)) { |
412 | - return call_user_func_array([$this->api, $name], $arguments); |
|
412 | + return call_user_func_array([ $this->api, $name ], $arguments); |
|
413 | 413 | } |
414 | 414 | throw new BadMethodCallException("Method {$name} not exists"); |
415 | 415 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function add(Closure $event, $checker = null) |
48 | 48 | { |
49 | - $this->events[] = !is_null($checker) ? new Event($event, $checker) |
|
50 | - : new Event($event, function () { |
|
49 | + $this->events[ ] = !is_null($checker) ? new Event($event, $checker) |
|
50 | + : new Event($event, function() { |
|
51 | 51 | }); |
52 | 52 | |
53 | 53 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (false === $event->executeAction($update)) { |
65 | 65 | if (!is_null($this->tracker)) { |
66 | 66 | $checker = new ReflectionFunction($event->getChecker()); |
67 | - $this->tracker->track($update->getMessage(), $checker->getStaticVariables()['name']); |
|
67 | + $this->tracker->track($update->getMessage(), $checker->getStaticVariables()[ 'name' ]); |
|
68 | 68 | } |
69 | 69 | break; |
70 | 70 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @var array |
17 | 17 | */ |
18 | - protected static $requiredParams = []; |
|
18 | + protected static $requiredParams = [ ]; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Map of input data |
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - protected static $map = []; |
|
25 | + protected static $map = [ ]; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Validate input data |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | public function map($data) |
46 | 46 | { |
47 | 47 | foreach (static::$map as $key => $item) { |
48 | - if (isset($data[$key]) && (!is_array($data[$key]) || (is_array($data[$key]) && !empty($data[$key])))) { |
|
48 | + if (isset($data[ $key ]) && (!is_array($data[ $key ]) || (is_array($data[ $key ]) && !empty($data[ $key ])))) { |
|
49 | 49 | $method = 'set' . self::toCamelCase($key); |
50 | 50 | if ($item === true) { |
51 | - $this->$method($data[$key]); |
|
51 | + $this->$method($data[ $key ]); |
|
52 | 52 | } else { |
53 | - $this->$method($item::fromResponse($data[$key])); |
|
53 | + $this->$method($item::fromResponse($data[ $key ])); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | |
64 | 64 | public function toJson($inner = false) |
65 | 65 | { |
66 | - $output = []; |
|
66 | + $output = [ ]; |
|
67 | 67 | |
68 | 68 | foreach (static::$map as $key => $item) { |
69 | 69 | $property = lcfirst(self::toCamelCase($key)); |
70 | 70 | if (!is_null($this->$property)) { |
71 | 71 | if (is_array($this->$property)) { |
72 | - $output[$key] = array_map( |
|
73 | - function ($v) { |
|
72 | + $output[ $key ] = array_map( |
|
73 | + function($v) { |
|
74 | 74 | return is_object($v) ? $v->toJson(true) : $v; |
75 | 75 | }, |
76 | 76 | $this->$property |
77 | 77 | ); |
78 | 78 | } else { |
79 | - $output[$key] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
79 | + $output[ $key ] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | |
78 | 78 | BotApi::curlValidate($this->curl); |
79 | 79 | |
80 | - if ($result['status'] !== 'accepted') { |
|
80 | + if ($result[ 'status' ] !== 'accepted') { |
|
81 | 81 | throw new Exception('Error Processing Request'); |
82 | 82 | } |
83 | 83 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @var array |
15 | 15 | */ |
16 | - protected $parameters = []; |
|
16 | + protected $parameters = [ ]; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * HttpException constructor. |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param Exception $previous [optional] The previous throwable used for the exception chaining. |
24 | 24 | * @param array $parameters [optional] Array of parameters returned from API. |
25 | 25 | */ |
26 | - public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = []) |
|
26 | + public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = [ ]) |
|
27 | 27 | { |
28 | 28 | $this->parameters = $parameters; |
29 | 29 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * @var array |
14 | 14 | */ |
15 | - protected $items = []; |
|
15 | + protected $items = [ ]; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @var int Max items count, if set 0 - unlimited |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($key == null) { |
36 | - $this->items[] = $item; |
|
36 | + $this->items[ ] = $item; |
|
37 | 37 | } else { |
38 | - if (isset($this->items[$key])) { |
|
38 | + if (isset($this->items[ $key ])) { |
|
39 | 39 | throw new KeyHasUseException("Key $key already in use."); |
40 | 40 | } |
41 | - $this->items[$key] = $item; |
|
41 | + $this->items[ $key ] = $item; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->checkItemKey($key); |
53 | 53 | |
54 | - unset($this->items[$key]); |
|
54 | + unset($this->items[ $key ]); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->checkItemKey($key); |
66 | 66 | |
67 | - return $this->items[$key]; |
|
67 | + return $this->items[ $key ]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function toJson($inner = false) |
83 | 83 | { |
84 | - $output = []; |
|
84 | + $output = [ ]; |
|
85 | 85 | foreach ($this->items as $item) { |
86 | - $output[] = $item->toJson(true); |
|
86 | + $output[ ] = $item->toJson(true); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $inner === false ? json_encode($output) : $output; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function checkItemKey($key) |
106 | 106 | { |
107 | - if (!isset($this->items[$key])) { |
|
107 | + if (!isset($this->items[ $key ])) { |
|
108 | 108 | throw new KeyInvalidException("Invalid key $key."); |
109 | 109 | } |
110 | 110 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | class MaskPosition extends BaseType implements TypeInterface |
16 | 16 | { |
17 | - protected static $requiredParams = ['point', 'x_shift', 'y_shift', 'scale']; |
|
17 | + protected static $requiredParams = [ 'point', 'x_shift', 'y_shift', 'scale' ]; |
|
18 | 18 | |
19 | 19 | protected static $map = [ |
20 | 20 | 'point' => true, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - protected static $requiredParams = ['name', 'icon_color']; |
|
22 | + protected static $requiredParams = [ 'name', 'icon_color' ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * {@inheritdoc} |
@@ -6,9 +6,9 @@ |
||
6 | 6 | { |
7 | 7 | public static function fromResponse($data) |
8 | 8 | { |
9 | - $arrayOfPollOption = []; |
|
9 | + $arrayOfPollOption = [ ]; |
|
10 | 10 | foreach ($data as $pollOptionItem) { |
11 | - $arrayOfPollOption[] = PollOption::fromResponse($pollOptionItem); |
|
11 | + $arrayOfPollOption[ ] = PollOption::fromResponse($pollOptionItem); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | return $arrayOfPollOption; |