Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-11-03 12:02:33 +00:00 committed by StyleCI Bot
parent e5da891ac2
commit da912540f9
13 changed files with 101 additions and 100 deletions

View File

@ -66,7 +66,7 @@ $message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sem
echo 'Serializing MadelineProto to s.madeline...'.PHP_EOL; echo 'Serializing MadelineProto to s.madeline...'.PHP_EOL;
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('s.madeline', $MadelineProto).' bytes'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('s.madeline', $MadelineProto).' bytes'.PHP_EOL;
$sent = [-440592694=>true]; $sent = [-440592694 => true];
$offset = 0; $offset = 0;
while (true) { while (true) {

View File

@ -66,6 +66,7 @@ class API extends APIFactory
$this->APIFactory(); $this->APIFactory();
$this->API = $unserialized->API; $this->API = $unserialized->API;
return; return;
} }
$this->API = new MTProto($params); $this->API = new MTProto($params);

View File

@ -153,7 +153,7 @@ class MTProto
]; ];
const TD_REVERSE = [ const TD_REVERSE = [
'sendMessage'=> 'messages.sendMessage', 'sendMessage' => 'messages.sendMessage',
]; ];
const TD_IGNORE = ['updateMessageID']; const TD_IGNORE = ['updateMessageID'];

View File

@ -214,7 +214,7 @@ trait PeerHandler
return $this->gen_all($this->chats[$id]); return $this->gen_all($this->chats[$id]);
} }
if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true) { if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true) {
$dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http'=> [ $dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http' => [
'timeout' => 2, 'timeout' => 2,
], ],
])), true); ])), true);

View File

@ -58,6 +58,6 @@ class Serialization
*/ */
public static function deserialize($filename, $no_updates = false) public static function deserialize($filename, $no_updates = false)
{ {
throw new \danog\MadelineProto\Exception('You can\'t call \danog\MadelineProto\Serialization::deserialize($filename) anymore, use new \danog\MadelineProto\API($filename) instead'.PHP_EOL.PHP_EOL."Protip: run the following command to fix all of your scripts:".PHP_EOL.PHP_EOL."find . -type f -exec sed 's/\\\\danog\\\\MadelineProto\\\\Serialization::deserialize/new \\\\danog\\\\MadelineProto\\\\API/g' -i {} +".PHP_EOL.PHP_EOL, 0, null, 'MadelineProto', 0); throw new \danog\MadelineProto\Exception('You can\'t call \danog\MadelineProto\Serialization::deserialize($filename) anymore, use new \danog\MadelineProto\API($filename) instead'.PHP_EOL.PHP_EOL.'Protip: run the following command to fix all of your scripts:'.PHP_EOL.PHP_EOL."find . -type f -exec sed 's/\\\\danog\\\\MadelineProto\\\\Serialization::deserialize/new \\\\danog\\\\MadelineProto\\\\API/g' -i {} +".PHP_EOL.PHP_EOL, 0, null, 'MadelineProto', 0);
} }
} }

View File

@ -108,7 +108,7 @@ trait TD
if (isset($params['fwd_from'])) { if (isset($params['fwd_from'])) {
$newparams[$td] = ['_' => 'messageForwardedFromUser']; $newparams[$td] = ['_' => 'messageForwardedFromUser'];
if (isset($params['fwd_from']['channel_id'])) { if (isset($params['fwd_from']['channel_id'])) {
$newparams[$td] = ['_'=> 'messageForwardedPost', 'chat_id' => '-100'.$params['fwd_from']['channel_id']]; $newparams[$td] = ['_' => 'messageForwardedPost', 'chat_id' => '-100'.$params['fwd_from']['channel_id']];
} }
$newparams[$td]['date'] = $params['fwd_from']['date']; $newparams[$td]['date'] = $params['fwd_from']['date'];
if (isset($params['fwd_from']['channel_post'])) { if (isset($params['fwd_from']['channel_post'])) {

View File

@ -13,7 +13,7 @@ If not, see <http://www.gnu.org/licenses/>.
require '../vendor/autoload.php'; require '../vendor/autoload.php';
$settings = []; $settings = [];
$settings = ['app_info'=>['api_id'=>6, 'api_hash'=>'eb06d4abfb49dc3eeb1aeb98ae0f581e']]; $settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
$MadelineProto = false; $MadelineProto = false;
try { try {

View File

@ -12,7 +12,7 @@ If not, see <http://www.gnu.org/licenses/>.
*/ */
require '../vendor/autoload.php'; require '../vendor/autoload.php';
$settings = ['app_info'=>['api_id'=>6, 'api_hash'=>'eb06d4abfb49dc3eeb1aeb98ae0f581e']]; $settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
$MadelineProto = false; $MadelineProto = false;
$uMadelineProto = false; $uMadelineProto = false;

View File

@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with Mad
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
require '../vendor/autoload.php'; require '../vendor/autoload.php';
$settings = ['app_info'=>['api_id'=>6, 'api_hash'=>'eb06d4abfb49dc3eeb1aeb98ae0f581e']]; $settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
include_once 'token.php'; include_once 'token.php';
try { try {