Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-01-29 01:47:20 +00:00 committed by StyleCI Bot
parent 77d735be0c
commit a686a0a886

View File

@ -472,29 +472,30 @@ trait UpdateHandler
} }
} }
public function pwr_webhook($update) { public function pwr_webhook($update)
$ch = curl_init(); {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->hook_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_URL, $this->hook_url);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($update)); curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($update));
$parse = parse_url($this->hook_url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if (isset($parse['scheme']) && $parse['scheme'] == 'https') { $parse = parse_url($this->hook_url);
if (isset($this->pem_path) && file_exists($this->pem_path)) { if (isset($parse['scheme']) && $parse['scheme'] == 'https') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); if (isset($this->pem_path) && file_exists($this->pem_path)) {
curl_setopt($ch, CURLOPT_CAINFO, $this->pem_path); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
} else { curl_setopt($ch, CURLOPT_CAINFO, $this->pem_path);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } else {
} curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
} }
$result = curl_exec($ch); }
$result = curl_exec($ch);
curl_close($ch); curl_close($ch);
\danog\MadelineProto\Logger::log(['Result of webhook query is '.$result], \danog\MadelineProto\Logger::NOTICE); \danog\MadelineProto\Logger::log(['Result of webhook query is '.$result], \danog\MadelineProto\Logger::NOTICE);
$result = json_decode($result, true); $result = json_decode($result, true);
if (is_array($result) && isset($result['method']) && $result['method'] != '' && is_string($result['method'])) { if (is_array($result) && isset($result['method']) && $result['method'] != '' && is_string($result['method'])) {
\danog\MadelineProto\Logger::log(['Reverse webhook command returned', $this->method_call($result['method'], $result)]); \danog\MadelineProto\Logger::log(['Reverse webhook command returned', $this->method_call($result['method'], $result)]);
} }
} }
} }