diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index 861d8905..b9d6a41d 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -60,14 +60,17 @@ class TL extends \danog\MadelineProto\Tools if ($tl_constructor === false) { throw new Exception('Could not extract type: '.$object); } + return $this->serialize_generic($tl_constructor, $arguments); } + public function serialize_method($method, $arguments) { $tl_method = $this->methods->find_by_method($method); if ($tl_method === false) { throw new Exception('Could not extract type: '.$method); } + return $this->serialize_generic($tl_method, $arguments); } @@ -86,7 +89,9 @@ class TL extends \danog\MadelineProto\Tools break; case 'Bool': $arguments[$cur_flag['name']] = (isset($arguments[$cur_flag['name']]) && $arguments[$cur_flag['name']]) && (($flags & $flag_pow) != 0); - if (($flags & $flag_pow) == 0) unset($arguments[$cur_flag['name']]); + if (($flags & $flag_pow) == 0) { + unset($arguments[$cur_flag['name']]); + } break; default: $flags = (isset($arguments[$cur_flag['name']]) && $arguments[$cur_flag['name']] !== null) ? ($flags | $flag_pow) : ($flags & ~$flag_pow); @@ -117,7 +122,8 @@ class TL extends \danog\MadelineProto\Tools if (!is_bool($value)) { throw new Exception("serialize_param: given value isn't a boolean"); } - return $this->serialize_param('bool'.($value ? "True" : "False")); + + return $this->serialize_param('bool'.($value ? 'True' : 'False')); break; case 'int': if (!is_numeric($value)) { @@ -180,6 +186,7 @@ class TL extends \danog\MadelineProto\Tools if ($tl_elem === false) { throw new Exception('Could not serialize type: '.$type); } + return \danog\PHP\Struct::pack('id[$this->key] = (int) $json_dict['id']; - $this->predicate[$this->key] = (string)((($mtproto && $json_dict['predicate'] == 'message') ? 'MT' : '').$json_dict['predicate']); + $this->predicate[$this->key] = (string) ((($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) { diff --git a/testing.php b/testing.php index f80a3967..c718ba9a 100755 --- a/testing.php +++ b/testing.php @@ -34,9 +34,9 @@ if (file_exists('number.php')) { } $authorization = $MadelineProto->auth->signIn( [ - 'phone_number' => $number, + 'phone_number' => $number, 'phone_code_hash' => $sentCode['phone_code_hash'], - 'phone_code' => $code, + 'phone_code' => $code, ] ); var_dump($authorization);