Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-01-27 21:05:24 +00:00 committed by StyleCI Bot
parent 632ca413d3
commit 0824470b71
14 changed files with 55 additions and 49 deletions

View File

@ -92,6 +92,7 @@ class APIFactory
public function __call($name, $arguments)
{
$this->API->get_config();
return $this->API->method_call($this->namespace.$name, (isset($arguments[0]) && is_array($arguments[0])) ? $arguments[0] : []);
}
}

View File

@ -201,7 +201,9 @@ trait PeerHandler
}
}
$dbres = file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id);
if ($dbres['ok']) return $this->gen_all('@'.$dbres['username']);
if ($dbres['ok']) {
return $this->gen_all('@'.$dbres['username']);
}
throw new \danog\MadelineProto\Exception("Couldn't find peer by provided chat id ".$id);
}
$id = str_replace('@', '', $id);

View File

@ -80,7 +80,8 @@ trait TL
}
}
public function get_method_namespaces() {
public function get_method_namespaces()
{
return $this->methods->method_namespace;
}

View File

@ -108,6 +108,7 @@ trait Login
if ($e->getMessage() === 'SESSION_PASSWORD_NEEDED') {
\danog\MadelineProto\Logger::log(['2FA enabled, you will have to call the complete_2fa_login function...'], \danog\MadelineProto\Logger::NOTICE);
$this->API->datacenter->login_temp_status = 'waiting_password';
return $this->API->datacenter->authorization = $this->account->getPassword();
}
throw $e;
@ -122,7 +123,6 @@ trait Login
return $this->API->datacenter->authorization;
}
public function complete_2fa_login($password)
{
if ($this->API->datacenter->login_temp_status !== 'waiting_password') {

View File

@ -49,11 +49,13 @@ if ($MadelineProto === false) {
}
if ($authorization['_'] === 'account.password') {
\danog\MadelineProto\Logger::log(['2FA is enabled'], \danog\MadelineProto\Logger::NOTICE);
$authorization = $MadelineProto->complete_2fa_login(readline("Please enter your password (hint ".$authorization['hint'].'): '));
$authorization = $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): '));
}
echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL;
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL;
} else $MadelineProto->bot_login(getenv('BOT_TOKEN'));
} else {
$MadelineProto->bot_login(getenv('BOT_TOKEN'));
}
}
$message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sembre) (yo lavorar siempre)' : ('Travis ci tests in progress: commit '.getenv('TRAVIS_COMMIT').', job '.getenv('TRAVIS_JOB_NUMBER').', PHP version: '.getenv('TRAVIS_PHP_VERSION'));