From c39c6a8511c6e1985e0affaa42d8920a4cb0e67d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 18 Nov 2016 20:50:38 +0000 Subject: [PATCH] Applied fixes from StyleCI --- src/danog/MadelineProto/MTProto.php | 2 +- src/danog/MadelineProto/MTProtoTools/MsgIdHandler.php | 1 + src/danog/MadelineProto/TL/TL.php | 4 ++-- src/danog/MadelineProto/TL/TLConstructor.php | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 9a015568..47c4ae34 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -74,7 +74,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB 'tl_schema' => [ 'layer' => 55, 'src' => [ - 'mtproto' => __DIR__.'/TL_mtproto_v1.json', + 'mtproto' => __DIR__.'/TL_mtproto_v1.json', 'telegram' => __DIR__.'/TL_telegram_v55.json', ], ], diff --git a/src/danog/MadelineProto/MTProtoTools/MsgIdHandler.php b/src/danog/MadelineProto/MTProtoTools/MsgIdHandler.php index 38b8ce11..a56dd910 100644 --- a/src/danog/MadelineProto/MTProtoTools/MsgIdHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/MsgIdHandler.php @@ -82,6 +82,7 @@ class MsgIdHandler extends MessageHandler $int_message_id = $keys + 4; } $this->check_message_id($int_message_id, true); + return $int_message_id; } } diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index 4cd6ca03..ea90bebd 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -20,9 +20,9 @@ class TL extends \danog\MadelineProto\Tools $this->constructors = new \danog\MadelineProto\TL\TLConstructor(); $this->methods = new \danog\MadelineProto\TL\TLMethod(); foreach ($filename as $type => $file) { - $type = $type === "mtproto"; + $type = $type === 'mtproto'; $TL_dict = json_decode(file_get_contents($file), true); - + \danog\MadelineProto\Logger::log('Translating objects...'); foreach ($TL_dict['constructors'] as $elem) { $this->constructors->add($elem, $type); diff --git a/src/danog/MadelineProto/TL/TLConstructor.php b/src/danog/MadelineProto/TL/TLConstructor.php index 9fbdbe56..69591012 100644 --- a/src/danog/MadelineProto/TL/TLConstructor.php +++ b/src/danog/MadelineProto/TL/TLConstructor.php @@ -23,7 +23,7 @@ class TLConstructor public function add($json_dict, $mtproto) { $this->id[$this->key] = (int) $json_dict['id']; - $this->predicate[$this->key] = (($mtproto && $json_dict['predicate'] == "message") ? "MT" : "").$json_dict['predicate']; + $this->predicate[$this->key] = (($mtproto && $json_dict['predicate'] == 'message') ? 'MT' : '').$json_dict['predicate']; $this->type[$this->key] = $json_dict['type']; $this->params[$this->key] = $json_dict['params']; foreach ($this->params[$this->key] as &$param) { @@ -46,7 +46,7 @@ class TLConstructor if (preg_match('/^\%/', $param['subtype'])) { $param['subtype'] = lcfirst(preg_replace('/^\%/', '', $param['subtype'])); } - $param['subtype'] = (($mtproto && $param['subtype'] == "message") ? "MT" : "").$param['subtype']; + $param['subtype'] = (($mtproto && $param['subtype'] == 'message') ? 'MT' : '').$param['subtype']; } } $this->key++; @@ -55,6 +55,7 @@ class TLConstructor public function find_by_predicate($predicate) { $key = array_search($predicate, $this->predicate); + return ($key === false) ? false : [ 'id' => $this->id[$key], 'predicate' => $this->predicate[$key],