@@ -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; |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public static function fromResponse($data) |
| 14 | 14 | { |
| 15 | - $arrayOfMessageEntity = []; |
|
| 15 | + $arrayOfMessageEntity = [ ]; |
|
| 16 | 16 | foreach ($data as $messageEntity) { |
| 17 | - $arrayOfMessageEntity[] = MessageEntity::fromResponse($messageEntity); |
|
| 17 | + $arrayOfMessageEntity[ ] = MessageEntity::fromResponse($messageEntity); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | return $arrayOfMessageEntity; |