From 3eca1368b25d7b6dcfe391ac60157052509831a4 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 30 Aug 2018 18:02:40 +0000 Subject: [PATCH] Apply fixes from StyleCI --- .../MTProtoTools/PeerHandler.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php index 094f75ff..e91188fc 100644 --- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php @@ -94,7 +94,7 @@ trait PeerHandler case 'userEmpty': break; default: - throw new \danog\MadelineProto\Exception('Invalid user provided at key ' . $key . ': ' . var_export($user, true)); + throw new \danog\MadelineProto\Exception('Invalid user provided at key '.$key.': '.var_export($user, true)); break; } } @@ -162,7 +162,7 @@ trait PeerHandler } break; default: - throw new \danog\MadelineProto\Exception('Invalid chat provided at key ' . $key . ': ' . var_export($chat, true)); + throw new \danog\MadelineProto\Exception('Invalid chat provided at key '.$key.': '.var_export($chat, true)); break; } } @@ -336,7 +336,7 @@ trait PeerHandler case 'channelForbidden': throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN'); default: - throw new \danog\MadelineProto\Exception('Invalid constructor given ' . var_export($id, true)); + throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($id, true)); break; } } @@ -345,7 +345,7 @@ trait PeerHandler $id = $this->to_supergroup($matches[1]); } if (preg_match('/^chat#(\d*)/', $id, $matches)) { - $id = '-' . $matches[1]; + $id = '-'.$matches[1]; } if (preg_match('/^user#(\d*)/', $id, $matches)) { $id = $matches[1]; @@ -370,9 +370,9 @@ trait PeerHandler } } if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true && $recursive) { - $dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id=' . $id, false, stream_context_create(['http' => ['timeout' => 2]])), true); + $dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http' => ['timeout' => 2]])), true); if (isset($dbres['ok']) && $dbres['ok']) { - $this->resolve_username('@' . $dbres['result']); + $this->resolve_username('@'.$dbres['result']); return $this->get_info($id, false); } @@ -466,7 +466,7 @@ trait PeerHandler throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN'); break; default: - throw new \danog\MadelineProto\Exception('Invalid constructor given ' . var_export($constructor, true)); + throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($constructor, true)); break; } @@ -648,7 +648,7 @@ trait PeerHandler foreach ($filters as $filter) { $this->recurse_alphabet_search_participants($full['InputChannel'], $filter, $q, $total_count, $res); } - $this->logger->logger('Fetched ' . count($res['participants']) . " out of $total_count"); + $this->logger->logger('Fetched '.count($res['participants'])." out of $total_count"); $res['participants'] = array_values($res['participants']); } if (!$fullfetch) { @@ -668,7 +668,7 @@ trait PeerHandler } for ($x = 'a'; $x !== 'aa' && $total_count > count($res['participants']); $x++) { - $this->recurse_alphabet_search_participants($channel, $filter, $q . $x, $total_count, $res); + $this->recurse_alphabet_search_participants($channel, $filter, $q.$x, $total_count, $res); } } @@ -743,7 +743,7 @@ trait PeerHandler } $res['participants'][$participant['user_id']] = $newres; } - $this->logger->logger('Fetched ' . count($gres['participants']) . " channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: " . ($cached ? 'cached' : 'not cached') . ', ' . ($offset + count($gres['participants'])) . ' participants out of ' . $gres['count'] . ', in total fetched ' . count($res['participants']) . ' out of ' . $total_count); + $this->logger->logger('Fetched '.count($gres['participants'])." channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: ".($cached ? 'cached' : 'not cached').', '.($offset + count($gres['participants'])).' participants out of '.$gres['count'].', in total fetched '.count($res['participants']).' out of '.$total_count); $offset += count($gres['participants']); } while (count($gres['participants'])); @@ -809,7 +809,7 @@ trait PeerHandler $id = isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id']; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_URL, 'https://id.pwrtelegram.xyz/db' . $this->settings['pwr']['db_token'] . '/addnewmadeline?d=pls&from=' . $id); + curl_setopt($ch, CURLOPT_URL, 'https://id.pwrtelegram.xyz/db'.$this->settings['pwr']['db_token'].'/addnewmadeline?d=pls&from='.$id); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); @@ -823,7 +823,7 @@ trait PeerHandler if (file_exists($path)) { unlink($path); } - $this->logger->logger('======= COULD NOT STORE IN DB DUE TO ' . $e->getMessage() . ' =============', \danog\MadelineProto\Logger::VERBOSE); + $this->logger->logger('======= COULD NOT STORE IN DB DUE TO '.$e->getMessage().' =============', \danog\MadelineProto\Logger::VERBOSE); } } @@ -832,7 +832,7 @@ trait PeerHandler try { $res = $this->method_call('contacts.resolveUsername', ['username' => str_replace('@', '', $username)], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { - $this->logger->logger('Username resolution failed with error ' . $e->getMessage(), \danog\MadelineProto\Logger::ERROR); + $this->logger->logger('Username resolution failed with error '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); if (strpos($e->rpc, 'FLOOD_WAIT_') === 0 || $e->rpc === 'AUTH_KEY_UNREGISTERED' || $e->rpc === 'USERNAME_INVALID') { throw $e; }