@@ -116,7 +116,7 @@ |
||
| 116 | 116 | */ |
| 117 | 117 | public function send($content = null) |
| 118 | 118 | { |
| 119 | - if (! is_null($content)) |
|
| 119 | + if (!is_null($content)) |
|
| 120 | 120 | $this->setContent($content); |
| 121 | 121 | |
| 122 | 122 | return $this->client->api->sendMessage($this); |
@@ -116,8 +116,9 @@ |
||
| 116 | 116 | */ |
| 117 | 117 | public function send($content = null) |
| 118 | 118 | { |
| 119 | - if (! is_null($content)) |
|
| 120 | - $this->setContent($content); |
|
| 119 | + if (! is_null($content)) { |
|
| 120 | + $this->setContent($content); |
|
| 121 | + } |
|
| 121 | 122 | |
| 122 | 123 | return $this->client->api->sendMessage($this); |
| 123 | 124 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | if (is_null($events_handler)) { |
| 30 | 30 | $events_handler = new EventsHandler(); |
| 31 | - } elseif (! $events_handler instanceof EventsHandler) { |
|
| 31 | + } elseif (!$events_handler instanceof EventsHandler) { |
|
| 32 | 32 | throw new InvalidArgumentException('Second parameter must be instance of EventsHandler'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function run($name, $data) |
| 28 | 28 | { |
| 29 | - if (! array_key_exists($name, $this->events)) |
|
| 29 | + if (!array_key_exists($name, $this->events)) |
|
| 30 | 30 | throw new \BadMethodCallException; |
| 31 | 31 | |
| 32 | 32 | if (is_callable($this->events[$name])) |
@@ -26,13 +26,15 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function run($name, $data) |
| 28 | 28 | { |
| 29 | - if (! array_key_exists($name, $this->events)) |
|
| 30 | - throw new \BadMethodCallException; |
|
| 29 | + if (! array_key_exists($name, $this->events)) { |
|
| 30 | + throw new \BadMethodCallException; |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | - if (is_callable($this->events[$name])) |
|
| 33 | - call_user_func($this->events[$name], $data); |
|
| 34 | - else |
|
| 35 | - call_user_func([$this, $this->events[$name]], $data); |
|
| 33 | + if (is_callable($this->events[$name])) { |
|
| 34 | + call_user_func($this->events[$name], $data); |
|
| 35 | + } else { |
|
| 36 | + call_user_func([$this, $this->events[$name]], $data); |
|
| 37 | + } |
|
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | /** |
@@ -137,12 +137,12 @@ |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $response = json_decode($this->guzzle->post($this->api_url_files, [ |
| 140 | - 'multipart' => [ |
|
| 141 | - [ |
|
| 140 | + 'multipart' => [ |
|
| 141 | + [ |
|
| 142 | 142 | 'name' => 'file', |
| 143 | 143 | 'contents' => fopen($filename, 'r') |
| 144 | - ] |
|
| 145 | - ] |
|
| 144 | + ] |
|
| 145 | + ] |
|
| 146 | 146 | ])->getBody()); |
| 147 | 147 | |
| 148 | 148 | if ((isset($response->success)) && ($response->success)) { |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | */ |
| 133 | 133 | public function uploadFile($filename) |
| 134 | 134 | { |
| 135 | - if (! file_exists($filename)) { |
|
| 135 | + if (!file_exists($filename)) { |
|
| 136 | 136 | throw new \BadMethodCallException('File not exists'); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | $media->setType(Message::CONTENT_TYPE_MEDIA_IMAGE); |
| 20 | 20 | $media->setContent($token); |
| 21 | 21 | |
| 22 | - $client->command('message/new', function ($message) use ($client, $media) { |
|
| 22 | + $client->command('message/new', function($message) use ($client, $media) { |
|
| 23 | 23 | |
| 24 | 24 | $client->to($message['chat_id'])->setType($media->getType())->send($media->getContent()); |
| 25 | 25 | /* or */ |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | try { |
| 9 | 9 | $client = new Client($API_KEY); |
| 10 | 10 | |
| 11 | - $client->command('user/follow', function ($user) use ($client) { |
|
| 11 | + $client->command('user/follow', function($user) use ($client) { |
|
| 12 | 12 | $chat = $client->api->createChat($user['id']); |
| 13 | 13 | |
| 14 | 14 | $client->to($chat->data->id)->send('Welcome'); |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | - $client->command('message/new', function ($message) use ($client) { |
|
| 17 | + $client->command('message/new', function($message) use ($client) { |
|
| 18 | 18 | $client->to($message['chat_id'])->setType($message['type'])->send($message['content']); |
| 19 | 19 | }); |
| 20 | 20 | |