This commit is contained in:
Daniil Gentili 2017-07-26 08:53:58 +02:00
parent 849ee4aa73
commit 541db2e507
2 changed files with 40 additions and 1 deletions

View File

@ -44,7 +44,7 @@ class MTProto extends \Volatile
use \danog\MadelineProto\Wrappers\DialogHandler;
use \danog\MadelineProto\Wrappers\Login;
const V = 59;
const V = 60;
const NOT_LOGGED_IN = 0;
const WAITING_CODE = 1;

View File

@ -0,0 +1,39 @@
<?php
/*
Copyright 2016-2017 Daniil Gentili
(https://daniil.it)
This file is part of MadelineProto.
MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License along with MadelineProto.
If not, see <http://www.gnu.org/licenses/>.
*/
namespace danog\MadelineProto\TL;
trait PrettyException
{
private $tl_trace;
public function getTLTrace() {
return $this->tl_trace;
}
public function prettify_tl($init = '') {
$tl = false;
foreach (array_reverse($this->getTrace()) as $frame){
if (isset($frame['function']) && in_array($frame['function'], ['serialize_params', 'serialize_object'])) {
$this->tl_trace .= $tl ? "['".$frame['args'][2]."']" : "While serializing: \t".$frame['args'][2];
$tl = true;
} else {
if ($tl) $this->tl_trace .= PHP_EOL;
$this->tl_trace .= isset($frame['file']) ? str_pad(basename($frame['file']).'('.$frame['line'].'):', 16)."\t" : '';
$this->tl_trace .= isset($frame['function']) ? $frame['function'].'(' : '';
$this->tl_trace .= isset($frame['args']) ? substr(json_encode($frame['args']), 1, -1) : '';
$this->tl_trace .= ')';
$this->tl_trace .= PHP_EOL;
$tl = false;
}
}
$this->tl_trace = $this->tl_trace."['".$init."']";
}
}