@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | { |
| 170 | 170 | if ($data = BotApi::jsonValidate((string) $this->getRawBody(), true)) { |
| 171 | 171 | /** @var array $data */ |
| 172 | - $this->handle([Update::fromResponse($data)]); |
|
| 172 | + $this->handle([ Update::fromResponse($data) ]); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | protected static function getEvent(Closure $action) |
| 192 | 192 | { |
| 193 | - return function (Update $update) use ($action) { |
|
| 193 | + return function(Update $update) use ($action) { |
|
| 194 | 194 | $message = $update->getMessage(); |
| 195 | 195 | if (!$message) { |
| 196 | 196 | return true; |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | preg_match(self::REGEXP, (string) $message->getText(), $matches); |
| 200 | 200 | |
| 201 | - if (isset($matches[3]) && !empty($matches[3])) { |
|
| 202 | - $parameters = str_getcsv($matches[3], chr(32)); |
|
| 201 | + if (isset($matches[ 3 ]) && !empty($matches[ 3 ])) { |
|
| 202 | + $parameters = str_getcsv($matches[ 3 ], chr(32)); |
|
| 203 | 203 | } else { |
| 204 | - $parameters = []; |
|
| 204 | + $parameters = [ ]; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | array_unshift($parameters, $message); |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | protected static function getEditedMessageEvent(Closure $action) |
| 223 | 223 | { |
| 224 | - return function (Update $update) use ($action) { |
|
| 224 | + return function(Update $update) use ($action) { |
|
| 225 | 225 | if (!$update->getEditedMessage()) { |
| 226 | 226 | return true; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $reflectionAction = new ReflectionFunction($action); |
| 230 | - $reflectionAction->invokeArgs([$update->getEditedMessage()]); |
|
| 230 | + $reflectionAction->invokeArgs([ $update->getEditedMessage() ]); |
|
| 231 | 231 | return false; |
| 232 | 232 | }; |
| 233 | 233 | } |
@@ -239,13 +239,13 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | protected static function getChannelPostEvent(Closure $action) |
| 241 | 241 | { |
| 242 | - return function (Update $update) use ($action) { |
|
| 242 | + return function(Update $update) use ($action) { |
|
| 243 | 243 | if (!$update->getChannelPost()) { |
| 244 | 244 | return true; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $reflectionAction = new ReflectionFunction($action); |
| 248 | - $reflectionAction->invokeArgs([$update->getChannelPost()]); |
|
| 248 | + $reflectionAction->invokeArgs([ $update->getChannelPost() ]); |
|
| 249 | 249 | return false; |
| 250 | 250 | }; |
| 251 | 251 | } |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | protected static function getCallbackQueryEvent(Closure $action) |
| 257 | 257 | { |
| 258 | - return function (Update $update) use ($action) { |
|
| 258 | + return function(Update $update) use ($action) { |
|
| 259 | 259 | if (!$update->getCallbackQuery()) { |
| 260 | 260 | return true; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $reflectionAction = new ReflectionFunction($action); |
| 264 | - $reflectionAction->invokeArgs([$update->getCallbackQuery()]); |
|
| 264 | + $reflectionAction->invokeArgs([ $update->getCallbackQuery() ]); |
|
| 265 | 265 | return false; |
| 266 | 266 | }; |
| 267 | 267 | } |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | protected static function getEditedChannelPostEvent(Closure $action) |
| 275 | 275 | { |
| 276 | - return function (Update $update) use ($action) { |
|
| 276 | + return function(Update $update) use ($action) { |
|
| 277 | 277 | if (!$update->getEditedChannelPost()) { |
| 278 | 278 | return true; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $reflectionAction = new ReflectionFunction($action); |
| 282 | - $reflectionAction->invokeArgs([$update->getEditedChannelPost()]); |
|
| 282 | + $reflectionAction->invokeArgs([ $update->getEditedChannelPost() ]); |
|
| 283 | 283 | return false; |
| 284 | 284 | }; |
| 285 | 285 | } |
@@ -289,13 +289,13 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected static function getInlineQueryEvent(Closure $action) |
| 291 | 291 | { |
| 292 | - return function (Update $update) use ($action) { |
|
| 292 | + return function(Update $update) use ($action) { |
|
| 293 | 293 | if (!$update->getInlineQuery()) { |
| 294 | 294 | return true; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | $reflectionAction = new ReflectionFunction($action); |
| 298 | - $reflectionAction->invokeArgs([$update->getInlineQuery()]); |
|
| 298 | + $reflectionAction->invokeArgs([ $update->getInlineQuery() ]); |
|
| 299 | 299 | return false; |
| 300 | 300 | }; |
| 301 | 301 | } |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | protected static function getChosenInlineResultEvent(Closure $action) |
| 309 | 309 | { |
| 310 | - return function (Update $update) use ($action) { |
|
| 310 | + return function(Update $update) use ($action) { |
|
| 311 | 311 | if (!$update->getChosenInlineResult()) { |
| 312 | 312 | return true; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $reflectionAction = new ReflectionFunction($action); |
| 316 | - $reflectionAction->invokeArgs([$update->getChosenInlineResult()]); |
|
| 316 | + $reflectionAction->invokeArgs([ $update->getChosenInlineResult() ]); |
|
| 317 | 317 | return false; |
| 318 | 318 | }; |
| 319 | 319 | } |
@@ -323,13 +323,13 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | protected static function getShippingQueryEvent(Closure $action) |
| 325 | 325 | { |
| 326 | - return function (Update $update) use ($action) { |
|
| 326 | + return function(Update $update) use ($action) { |
|
| 327 | 327 | if (!$update->getShippingQuery()) { |
| 328 | 328 | return true; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $reflectionAction = new ReflectionFunction($action); |
| 332 | - $reflectionAction->invokeArgs([$update->getShippingQuery()]); |
|
| 332 | + $reflectionAction->invokeArgs([ $update->getShippingQuery() ]); |
|
| 333 | 333 | return false; |
| 334 | 334 | }; |
| 335 | 335 | } |
@@ -341,13 +341,13 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | protected static function getPreCheckoutQueryEvent(Closure $action) |
| 343 | 343 | { |
| 344 | - return function (Update $update) use ($action) { |
|
| 344 | + return function(Update $update) use ($action) { |
|
| 345 | 345 | if (!$update->getPreCheckoutQuery()) { |
| 346 | 346 | return true; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $reflectionAction = new ReflectionFunction($action); |
| 350 | - $reflectionAction->invokeArgs([$update->getPreCheckoutQuery()]); |
|
| 350 | + $reflectionAction->invokeArgs([ $update->getPreCheckoutQuery() ]); |
|
| 351 | 351 | return false; |
| 352 | 352 | }; |
| 353 | 353 | } |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | protected static function getChecker($name) |
| 363 | 363 | { |
| 364 | - return function (Update $update) use ($name) { |
|
| 364 | + return function(Update $update) use ($name) { |
|
| 365 | 365 | $message = $update->getMessage(); |
| 366 | 366 | if (!$message) { |
| 367 | 367 | return false; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | preg_match(self::REGEXP, $text, $matches); |
| 375 | 375 | |
| 376 | - return !empty($matches) && $matches[1] == $name; |
|
| 376 | + return !empty($matches) && $matches[ 1 ] == $name; |
|
| 377 | 377 | }; |
| 378 | 378 | } |
| 379 | 379 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | protected static function getEditedMessageChecker() |
| 386 | 386 | { |
| 387 | - return function (Update $update) { |
|
| 387 | + return function(Update $update) { |
|
| 388 | 388 | return !is_null($update->getEditedMessage()); |
| 389 | 389 | }; |
| 390 | 390 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | protected static function getChannelPostChecker() |
| 398 | 398 | { |
| 399 | - return function (Update $update) { |
|
| 399 | + return function(Update $update) { |
|
| 400 | 400 | return !is_null($update->getChannelPost()); |
| 401 | 401 | }; |
| 402 | 402 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | */ |
| 409 | 409 | protected static function getCallbackQueryChecker() |
| 410 | 410 | { |
| 411 | - return function (Update $update) { |
|
| 411 | + return function(Update $update) { |
|
| 412 | 412 | return !is_null($update->getCallbackQuery()); |
| 413 | 413 | }; |
| 414 | 414 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | protected static function getEditedChannelPostChecker() |
| 422 | 422 | { |
| 423 | - return function (Update $update) { |
|
| 423 | + return function(Update $update) { |
|
| 424 | 424 | return !is_null($update->getEditedChannelPost()); |
| 425 | 425 | }; |
| 426 | 426 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | protected static function getChosenInlineResultChecker() |
| 434 | 434 | { |
| 435 | - return function (Update $update) { |
|
| 435 | + return function(Update $update) { |
|
| 436 | 436 | return !is_null($update->getChosenInlineResult()); |
| 437 | 437 | }; |
| 438 | 438 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | protected static function getInlineQueryChecker() |
| 446 | 446 | { |
| 447 | - return function (Update $update) { |
|
| 447 | + return function(Update $update) { |
|
| 448 | 448 | return !is_null($update->getInlineQuery()); |
| 449 | 449 | }; |
| 450 | 450 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | protected static function getShippingQueryChecker() |
| 458 | 458 | { |
| 459 | - return function (Update $update) { |
|
| 459 | + return function(Update $update) { |
|
| 460 | 460 | return !is_null($update->getShippingQuery()); |
| 461 | 461 | }; |
| 462 | 462 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | protected static function getPreCheckoutQueryChecker() |
| 470 | 470 | { |
| 471 | - return function (Update $update) { |
|
| 471 | + return function(Update $update) { |
|
| 472 | 472 | return !is_null($update->getPreCheckoutQuery()); |
| 473 | 473 | }; |
| 474 | 474 | } |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | public function __call($name, array $arguments) |
| 483 | 483 | { |
| 484 | 484 | if (method_exists($this, $name)) { |
| 485 | - return call_user_func_array([$this, $name], $arguments); |
|
| 485 | + return call_user_func_array([ $this, $name ], $arguments); |
|
| 486 | 486 | } elseif (method_exists($this->api, $name)) { |
| 487 | - return call_user_func_array([$this->api, $name], $arguments); |
|
| 487 | + return call_user_func_array([ $this->api, $name ], $arguments); |
|
| 488 | 488 | } |
| 489 | 489 | throw new BadMethodCallException("Method {$name} not exists"); |
| 490 | 490 | } |
@@ -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 |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | public function map($data) |
| 50 | 50 | { |
| 51 | 51 | foreach (static::$map as $key => $item) { |
| 52 | - if (isset($data[$key]) && (!is_array($data[$key]) || !empty($data[$key]))) { |
|
| 52 | + if (isset($data[ $key ]) && (!is_array($data[ $key ]) || !empty($data[ $key ]))) { |
|
| 53 | 53 | $method = 'set' . self::toCamelCase($key); |
| 54 | 54 | if ($item === true) { |
| 55 | - $this->$method($data[$key]); |
|
| 55 | + $this->$method($data[ $key ]); |
|
| 56 | 56 | } else { |
| 57 | - $this->$method($item::fromResponse($data[$key])); |
|
| 57 | + $this->$method($item::fromResponse($data[ $key ])); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -75,24 +75,24 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function toJson($inner = false) |
| 77 | 77 | { |
| 78 | - $output = []; |
|
| 78 | + $output = [ ]; |
|
| 79 | 79 | |
| 80 | 80 | foreach (static::$map as $key => $item) { |
| 81 | 81 | $property = lcfirst(self::toCamelCase($key)); |
| 82 | 82 | if (!is_null($this->$property)) { |
| 83 | 83 | if (is_array($this->$property)) { |
| 84 | - $output[$key] = array_map( |
|
| 84 | + $output[ $key ] = array_map( |
|
| 85 | 85 | /** |
| 86 | 86 | * @param mixed $v |
| 87 | 87 | * @return array|false|string |
| 88 | 88 | */ |
| 89 | - function ($v) { |
|
| 89 | + function($v) { |
|
| 90 | 90 | return is_object($v) ? $v->toJson(true) : $v; |
| 91 | 91 | }, |
| 92 | 92 | $this->$property |
| 93 | 93 | ); |
| 94 | 94 | } else { |
| 95 | - $output[$key] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
| 95 | + $output[ $key ] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public static function fromResponse($data) |
| 12 | 12 | { |
| 13 | - $arrayOfPollOption = []; |
|
| 13 | + $arrayOfPollOption = [ ]; |
|
| 14 | 14 | foreach ($data as $pollOptionItem) { |
| 15 | - $arrayOfPollOption[] = PollOption::fromResponse($pollOptionItem); |
|
| 15 | + $arrayOfPollOption[ ] = PollOption::fromResponse($pollOptionItem); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | return $arrayOfPollOption; |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function fromResponse($data) |
| 18 | 18 | { |
| 19 | - $arrayOfMessageEntity = []; |
|
| 19 | + $arrayOfMessageEntity = [ ]; |
|
| 20 | 20 | foreach ($data as $messageEntity) { |
| 21 | - $arrayOfMessageEntity[] = MessageEntity::fromResponse($messageEntity); |
|
| 21 | + $arrayOfMessageEntity[ ] = MessageEntity::fromResponse($messageEntity); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | return $arrayOfMessageEntity; |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public static function fromResponse($data) |
| 12 | 12 | { |
| 13 | - $arrayOfMessages = []; |
|
| 13 | + $arrayOfMessages = [ ]; |
|
| 14 | 14 | foreach ($data as $message) { |
| 15 | - $arrayOfMessages[] = Message::fromResponse($message); |
|
| 15 | + $arrayOfMessages[ ] = Message::fromResponse($message); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | return $arrayOfMessages; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @var array |
| 18 | 18 | */ |
| 19 | - protected static $requiredParams = ['message_id', 'date', 'chat']; |
|
| 19 | + protected static $requiredParams = [ 'message_id', 'date', 'chat' ]; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * {@inheritdoc} |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public static function fromResponse($data) |
| 12 | 12 | { |
| 13 | - $arrayOfUsers = []; |
|
| 13 | + $arrayOfUsers = [ ]; |
|
| 14 | 14 | foreach ($data as $user) { |
| 15 | - $arrayOfUsers[] = User::fromResponse($user); |
|
| 15 | + $arrayOfUsers[ ] = User::fromResponse($user); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | return $arrayOfUsers; |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public static function fromResponse($data) |
| 12 | 12 | { |
| 13 | - return array_map(function ($arrayOfPhotoSize) { |
|
| 13 | + return array_map(function($arrayOfPhotoSize) { |
|
| 14 | 14 | return ArrayOfPhotoSize::fromResponse($arrayOfPhotoSize); |
| 15 | 15 | }, $data); |
| 16 | 16 | } |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public static function fromResponse($data) |
| 12 | 12 | { |
| 13 | - $arrayOfPhotoSize = []; |
|
| 13 | + $arrayOfPhotoSize = [ ]; |
|
| 14 | 14 | foreach ($data as $photoSizeItem) { |
| 15 | - $arrayOfPhotoSize[] = PhotoSize::fromResponse($photoSizeItem); |
|
| 15 | + $arrayOfPhotoSize[ ] = PhotoSize::fromResponse($photoSizeItem); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | return $arrayOfPhotoSize; |