Apply fixes from StyleCI
This commit is contained in:
parent
849ee4aa73
commit
8aaedac7a7
@ -15,9 +15,12 @@ namespace danog\MadelineProto;
|
|||||||
class Exception extends \Exception
|
class Exception extends \Exception
|
||||||
{
|
{
|
||||||
use TL\PrettyException;
|
use TL\PrettyException;
|
||||||
public function __toString() {
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
return $this->file === 'MadelineProto' ? $this->message : '\danog\MadelineProto\Exception'.($this->message !== '' ? ': ' : '').$this->message.' in '.$this->file.':'.$this->line.PHP_EOL.'TL Trace:'.PHP_EOL.$this->getTLTrace();
|
return $this->file === 'MadelineProto' ? $this->message : '\danog\MadelineProto\Exception'.($this->message !== '' ? ': ' : '').$this->message.' in '.$this->file.':'.$this->line.PHP_EOL.'TL Trace:'.PHP_EOL.$this->getTLTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($message = null, $code = 0, Exception $previous = null, $file = null, $line = null)
|
public function __construct($message = null, $code = 0, Exception $previous = null, $file = null, $line = null)
|
||||||
{
|
{
|
||||||
$this->prettify_tl();
|
$this->prettify_tl();
|
||||||
|
@ -111,7 +111,7 @@ class Logger
|
|||||||
throw new \danog\MadelineProto\Exception(hex2bin('506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e'), 0, null, 'MadelineProto', 1);
|
throw new \danog\MadelineProto\Exception(hex2bin('506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e'), 0, null, 'MadelineProto', 1);
|
||||||
}
|
}
|
||||||
if (class_exists('\danog\MadelineProto\VoIP')) {
|
if (class_exists('\danog\MadelineProto\VoIP')) {
|
||||||
if (!defined('\danog\MadelineProto\VoIP::PHP_LIBTGVOIP_VERSION') || \danog\MadelineProto\VoIP::PHP_LIBTGVOIP_VERSION !== "1.1") {
|
if (!defined('\danog\MadelineProto\VoIP::PHP_LIBTGVOIP_VERSION') || \danog\MadelineProto\VoIP::PHP_LIBTGVOIP_VERSION !== '1.1') {
|
||||||
throw new \danog\MadelineProto\Exception(hex2bin('506c6561736520757064617465207068702d6c69627467766f6970'), 0, null, 'MadelineProto', 1);
|
throw new \danog\MadelineProto\Exception(hex2bin('506c6561736520757064617465207068702d6c69627467766f6970'), 0, null, 'MadelineProto', 1);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -273,7 +273,7 @@ class MTProto extends \Volatile
|
|||||||
foreach ($this->calls as $id => $controller) {
|
foreach ($this->calls as $id => $controller) {
|
||||||
if (!is_object($controller)) {
|
if (!is_object($controller)) {
|
||||||
unset($this->calls[$id]);
|
unset($this->calls[$id]);
|
||||||
} else if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) {
|
} elseif ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) {
|
||||||
$controller->setMadeline($this);
|
$controller->setMadeline($this);
|
||||||
$controller->discard();
|
$controller->discard();
|
||||||
} else {
|
} else {
|
||||||
|
@ -249,7 +249,7 @@ trait CallHandler
|
|||||||
$server_answer = [$server_answer];
|
$server_answer = [$server_answer];
|
||||||
foreach ($message_chunks as $message) {
|
foreach ($message_chunks as $message) {
|
||||||
$args['message'] = $message;
|
$args['message'] = $message;
|
||||||
$server_answer[]= $this->method_call($method, $args, $aargs);
|
$server_answer[] = $this->method_call($method, $args, $aargs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,12 @@ namespace danog\MadelineProto;
|
|||||||
class RPCErrorException extends \Exception
|
class RPCErrorException extends \Exception
|
||||||
{
|
{
|
||||||
use TL\PrettyException;
|
use TL\PrettyException;
|
||||||
public function __toString() { return 'Telegram returned an RPC error: '.$this->message.' ('.$this->rpc.'), caused by '.$this->file.':'.$this->line.PHP_EOL.PHP_EOL.'TL trace:'.PHP_EOL.$this->getTLTrace().PHP_EOL; }
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return 'Telegram returned an RPC error: '.$this->message.' ('.$this->rpc.'), caused by '.$this->file.':'.$this->line.PHP_EOL.PHP_EOL.'TL trace:'.PHP_EOL.$this->getTLTrace().PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct($message = null, $code = 0, Exception $previous = null)
|
public function __construct($message = null, $code = 0, Exception $previous = null)
|
||||||
{
|
{
|
||||||
$this->rpc = $message;
|
$this->rpc = $message;
|
||||||
|
@ -62,7 +62,8 @@ class Serialization
|
|||||||
$unserialized = \danog\Serialization::unserialize($unserialized);
|
$unserialized = \danog\Serialization::unserialize($unserialized);
|
||||||
/*} catch (Exception $e) {
|
/*} catch (Exception $e) {
|
||||||
$unserialized = \danog\Serialization::unserialize($unserialized);
|
$unserialized = \danog\Serialization::unserialize($unserialized);
|
||||||
*/} catch (\Error $e) {
|
*/
|
||||||
|
} catch (\Error $e) {
|
||||||
$unserialized = \danog\Serialization::unserialize($unserialized);
|
$unserialized = \danog\Serialization::unserialize($unserialized);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,7 +232,9 @@ trait BotAPI
|
|||||||
return $data;
|
return $data;
|
||||||
|
|
||||||
case 'messageMediaPhoto':
|
case 'messageMediaPhoto':
|
||||||
if (isset($data['caption'])) $res['caption'] = $data['caption'];
|
if (isset($data['caption'])) {
|
||||||
|
$res['caption'] = $data['caption'];
|
||||||
|
}
|
||||||
$res['photo'] = [];
|
$res['photo'] = [];
|
||||||
foreach ($data['photo']['sizes'] as $key => $photo) {
|
foreach ($data['photo']['sizes'] as $key => $photo) {
|
||||||
$res['photo'][$key] = $this->photosize_to_botapi($photo, $data['photo']);
|
$res['photo'][$key] = $this->photosize_to_botapi($photo, $data['photo']);
|
||||||
|
@ -15,8 +15,14 @@ namespace danog\MadelineProto\TL;
|
|||||||
class Exception extends \Exception
|
class Exception extends \Exception
|
||||||
{
|
{
|
||||||
use PrettyException;
|
use PrettyException;
|
||||||
public function __toString() { return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; }
|
|
||||||
public function __construct($message, $file = '') {
|
public function __toString()
|
||||||
|
{
|
||||||
|
return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct($message, $file = '')
|
||||||
|
{
|
||||||
parent::__construct($message);
|
parent::__construct($message);
|
||||||
$this->prettify_tl($file);
|
$this->prettify_tl($file);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user