1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 09:34:38 +01:00

Implemented phpstruct and started turning everything into classes.

This commit is contained in:
danogentili 2016-07-14 14:25:00 +02:00
parent 24396b23f0
commit e14d08750a

3
TL.php
View File

@ -92,7 +92,6 @@ class TL {
return fread_all($bytes_io); return fread_all($bytes_io);
} }
function serialize_param($bytes_io, $type_, $value) { function serialize_param($bytes_io, $type_, $value) {
var_dump("here", $value, $type_);
if (($type_ == 'int')) { if (($type_ == 'int')) {
assert(is_numeric($value)); assert(is_numeric($value));
assert(strlen(decbin($value)) <= 32); assert(strlen(decbin($value)) <= 32);
@ -102,7 +101,7 @@ class TL {
fwrite($bytes_io, $this->struct->pack('<q', $value)); fwrite($bytes_io, $this->struct->pack('<q', $value));
} else if (in_array($type_, ['int128', 'int256'])) { } else if (in_array($type_, ['int128', 'int256'])) {
assert(is_string($value)); assert(is_string($value));
fwrite($bytes_io, $value); fwrite($bytes_io, $value);
} else if ($type_ == 'string' || $type_ == 'bytes') { } else if ($type_ == 'string' || $type_ == 'bytes') {
$l = len($value); $l = len($value);
if (($l < 254)) { if (($l < 254)) {