Skip to content

Commit f623821

Browse files
authored
Merge pull request #176 from Eleirbag89/analysis-8j3MlL
Apply fixes from StyleCI
2 parents 4cb023a + 564b5b9 commit f623821

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

Telegram.php

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Telegram
5050
/**
5151
* Constant for type animation.
5252
*/
53-
const ANIMATION = 'animation';
53+
const ANIMATION = 'animation';
5454
/**
5555
* Constant for type Document.
5656
*/
@@ -72,23 +72,23 @@ class Telegram
7272
private $data = [];
7373
private $updates = [];
7474
private $log_errors;
75-
private $proxy;
75+
private $proxy;
7676

7777
/// Class constructor
7878

7979
/**
8080
* Create a Telegram instance from the bot token
8181
* \param $bot_token the bot token
82-
* \param $log_errors enable or disable the logging
83-
* \param $proxy array with the proxy configuration (url, port, type, auth)
82+
* \param $log_errors enable or disable the logging
83+
* \param $proxy array with the proxy configuration (url, port, type, auth)
8484
* \return an instance of the class.
8585
*/
86-
public function __construct($bot_token, $log_errors = true, array $proxy=array())
86+
public function __construct($bot_token, $log_errors = true, array $proxy = [])
8787
{
8888
$this->bot_token = $bot_token;
8989
$this->data = $this->getData();
9090
$this->log_errors = $log_errors;
91-
$this->proxy = $proxy;
91+
$this->proxy = $proxy;
9292
}
9393

9494
/// Do requests to Telegram Bot API
@@ -3041,13 +3041,13 @@ public function getUpdateType()
30413041
}
30423042
if (isset($update['message']['reply_to_message'])) {
30433043
return self::REPLY;
3044-
}
3044+
}
30453045
if (isset($update['message']['animation'])) {
30463046
return self::ANIMATION;
3047-
}
3047+
}
30483048
if (isset($update['message']['document'])) {
30493049
return self::DOCUMENT;
3050-
}
3050+
}
30513051
if (isset($update['channel_post'])) {
30523052
return self::CHANNEL_POST;
30533053
}
@@ -3069,34 +3069,33 @@ private function sendAPIRequest($url, array $content, $post = true)
30693069
curl_setopt($ch, CURLOPT_POST, 1);
30703070
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
30713071
}
3072-
// echo "inside curl if";
3073-
if (!empty($this->proxy)) {
3074-
// echo "inside proxy if";
3075-
if (array_key_exists("type", $this->proxy)) {
3076-
curl_setopt($ch, CURLOPT_PROXYTYPE, $this->proxy["type"]);
3077-
}
3078-
3079-
if (array_key_exists("auth", $this->proxy)) {
3080-
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxy["auth"]);
3081-
}
3082-
3083-
if (array_key_exists("url", $this->proxy)) {
3084-
// echo "Proxy Url";
3085-
curl_setopt($ch, CURLOPT_PROXY, $this->proxy["url"]);
3086-
}
3087-
3088-
if (array_key_exists("port", $this->proxy)) {
3089-
// echo "Proxy port";
3090-
curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy["port"]);
3091-
}
3092-
3093-
}
3072+
// echo "inside curl if";
3073+
if (!empty($this->proxy)) {
3074+
// echo "inside proxy if";
3075+
if (array_key_exists('type', $this->proxy)) {
3076+
curl_setopt($ch, CURLOPT_PROXYTYPE, $this->proxy['type']);
3077+
}
3078+
3079+
if (array_key_exists('auth', $this->proxy)) {
3080+
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxy['auth']);
3081+
}
3082+
3083+
if (array_key_exists('url', $this->proxy)) {
3084+
// echo "Proxy Url";
3085+
curl_setopt($ch, CURLOPT_PROXY, $this->proxy['url']);
3086+
}
3087+
3088+
if (array_key_exists('port', $this->proxy)) {
3089+
// echo "Proxy port";
3090+
curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy['port']);
3091+
}
3092+
}
30943093
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
30953094
$result = curl_exec($ch);
30963095
if ($result === false) {
30973096
$result = json_encode(['ok'=>false, 'curl_error_code' => curl_errno($ch), 'curl_error' => curl_error($ch)]);
30983097
}
3099-
echo $result;
3098+
echo $result;
31003099
curl_close($ch);
31013100
if ($this->log_errors) {
31023101
if (class_exists('TelegramErrorLogger')) {

0 commit comments

Comments
 (0)