Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2016-12-19 17:58:09 +00:00 committed by StyleCI Bot
parent fa1183b25e
commit 9fd4b22c42
3 changed files with 27 additions and 34 deletions

View File

@ -51,7 +51,6 @@ mkdir('methods');
$methods = []; $methods = [];
$types = []; $types = [];
\danog\MadelineProto\Logger::log('Generating methods documentation...'); \danog\MadelineProto\Logger::log('Generating methods documentation...');
@ -59,10 +58,11 @@ foreach ($TL->methods->method as $key => $method) {
$type = str_replace(['.', '<', '>'], ['_', '_of_', ''], $TL->methods->type[$key]); $type = str_replace(['.', '<', '>'], ['_', '_of_', ''], $TL->methods->type[$key]);
$real_type = preg_replace('/.*_of_/', '', $type); $real_type = preg_replace('/.*_of_/', '', $type);
$params = ''; $params = '';
foreach ($TL->methods->params[$key] as $param) { foreach ($TL->methods->params[$key] as $param) {
if ($param['name'] == 'flags') continue; if ($param['name'] == 'flags') {
continue;
}
$stype = 'type'; $stype = 'type';
$link_type = 'types'; $link_type = 'types';
if (isset($param['subtype'])) { if (isset($param['subtype'])) {
@ -84,13 +84,14 @@ foreach ($TL->methods->method as $key => $method) {
'); ');
$params = ''; $params = '';
$table = '| Name | Type | Required | $table = '| Name | Type | Required |
|----------|:-------------:|---------:| |----------|:-------------:|---------:|
'; ';
foreach ($TL->methods->params[$key] as $param) { foreach ($TL->methods->params[$key] as $param) {
if ($param['name'] == 'flags') continue; if ($param['name'] == 'flags') {
continue;
}
$ptype = str_replace('.', '_', $param[isset($param['subtype']) ? 'subtype' : 'type']); $ptype = str_replace('.', '_', $param[isset($param['subtype']) ? 'subtype' : 'type']);
switch ($ptype) { switch ($ptype) {
case 'true': case 'true':
@ -102,7 +103,6 @@ foreach ($TL->methods->method as $key => $method) {
$params .= "'".$param['name']."' => "; $params .= "'".$param['name']."' => ";
$params .= (isset($param['subtype']) ? '['.$ptype.']' : $ptype).', '; $params .= (isset($param['subtype']) ? '['.$ptype.']' : $ptype).', ';
} }
$example = str_replace('[]', '', ' $example = str_replace('[]', '', '
``` ```
@ -151,9 +151,7 @@ file_put_contents('methods/index.md', '# Methods
} }
</style> </style>
<div class="container"> <div class="container">
'.join('', $methods).'</div>'); '.implode('', $methods).'</div>');
foreach (glob('constructors/*') as $unlink) { foreach (glob('constructors/*') as $unlink) {
unlink($unlink); unlink($unlink);
@ -177,7 +175,9 @@ foreach ($TL->constructors->predicate as $key => $constructor) {
$params = ''; $params = '';
foreach ($TL->constructors->params[$key] as $param) { foreach ($TL->constructors->params[$key] as $param) {
if ($param['name'] == 'flags') continue; if ($param['name'] == 'flags') {
continue;
}
$stype = 'type'; $stype = 'type';
$link_type = 'types'; $link_type = 'types';
if (isset($param['subtype'])) { if (isset($param['subtype'])) {
@ -187,7 +187,6 @@ foreach ($TL->constructors->predicate as $key => $constructor) {
} }
} }
$ptype = str_replace('.', '_', $param[$stype]); $ptype = str_replace('.', '_', $param[$stype]);
switch ($ptype) { switch ($ptype) {
case 'true': case 'true':
@ -202,7 +201,6 @@ foreach ($TL->constructors->predicate as $key => $constructor) {
'); ');
if (!isset($types[$real_type])) { if (!isset($types[$real_type])) {
$types[$real_type] = []; $types[$real_type] = [];
} }
@ -215,7 +213,9 @@ foreach ($TL->constructors->predicate as $key => $constructor) {
|----------|:-------------:|---------:| |----------|:-------------:|---------:|
'; ';
foreach ($TL->constructors->params[$key] as $param) { foreach ($TL->constructors->params[$key] as $param) {
if ($param['name'] == 'flags') continue; if ($param['name'] == 'flags') {
continue;
}
$ptype = str_replace('.', '_', $param[isset($param['subtype']) ? 'subtype' : 'type']); $ptype = str_replace('.', '_', $param[isset($param['subtype']) ? 'subtype' : 'type']);
$link_type = 'types'; $link_type = 'types';
@ -234,7 +234,6 @@ foreach ($TL->constructors->predicate as $key => $constructor) {
$params .= "'".$param['name']."' => "; $params .= "'".$param['name']."' => ";
$params .= (isset($param['subtype']) ? '['.$ptype.']' : $ptype).', '; $params .= (isset($param['subtype']) ? '['.$ptype.']' : $ptype).', ';
} }
$example = str_replace('[]', '', ' $example = str_replace('[]', '', '
``` ```
@ -254,7 +253,6 @@ $'.$constructor.' = ['.$params.'];
file_put_contents('constructors/'.$constructor.'.md', $header.$example); file_put_contents('constructors/'.$constructor.'.md', $header.$example);
} }
\danog\MadelineProto\Logger::log('Generating constructors index...'); \danog\MadelineProto\Logger::log('Generating constructors index...');
ksort($constructors); ksort($constructors);
@ -270,8 +268,7 @@ file_put_contents('constructors/index.md', '# Constructors
} }
</style> </style>
<div class="container"> <div class="container">
'.join('', $constructors).'</div>'); '.implode('', $constructors).'</div>');
foreach (glob('types/*') as $unlink) { foreach (glob('types/*') as $unlink) {
unlink($unlink); unlink($unlink);
@ -316,7 +313,6 @@ foreach ($types as $type => $keys) {
file_put_contents('types/'.$type.'.md', $header); file_put_contents('types/'.$type.'.md', $header);
} }
\danog\MadelineProto\Logger::log('Generating additional types...'); \danog\MadelineProto\Logger::log('Generating additional types...');
file_put_contents('types/string.md', '## Type: string file_put_contents('types/string.md', '## Type: string

View File

@ -27,7 +27,6 @@ class MTProto extends PrimeModule
use \danog\MadelineProto\MTProtoTools\SaltHandler; use \danog\MadelineProto\MTProtoTools\SaltHandler;
use \danog\MadelineProto\MTProtoTools\SeqNoHandler; use \danog\MadelineProto\MTProtoTools\SeqNoHandler;
public $settings = []; public $settings = [];
public $authorized = false; public $authorized = false;
public $waiting_code = false; public $waiting_code = false;
@ -284,7 +283,6 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
\danog\MadelineProto\Logger::log('Generating temporary authorization key...'); \danog\MadelineProto\Logger::log('Generating temporary authorization key...');
$this->datacenter->temp_auth_key = $this->create_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']); $this->datacenter->temp_auth_key = $this->create_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']);
$this->bind_temp_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']); $this->bind_temp_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']);
} }
} }

View File

@ -65,7 +65,6 @@ trait MessageHandler
$this->parse_config(); $this->parse_config();
throw new \danog\MadelineProto\Exception('I had to recreate the temporary authorization key'); throw new \danog\MadelineProto\Exception('I had to recreate the temporary authorization key');
} }
} }
throw new \danog\MadelineProto\RPCErrorException($error, $error); throw new \danog\MadelineProto\RPCErrorException($error, $error);
} }