Applied fixes from StyleCI

This commit is contained in:
Daniil Gentili 2016-11-18 20:50:38 +00:00 committed by StyleCI Bot
parent 545b5629f6
commit c39c6a8511
4 changed files with 7 additions and 5 deletions

View File

@ -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',
],
],

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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],