@@ -145,7 +145,7 @@ |
||
| 145 | 145 | */ |
| 146 | 146 | protected function processUri($uri) |
| 147 | 147 | { |
| 148 | - return preg_replace_callback('#\{([a-zA-Z0-9_,]*)\}#i', function ($matches) { |
|
| 148 | + return preg_replace_callback('#\{([a-zA-Z0-9_,]*)\}#i', function($matches) { |
|
| 149 | 149 | return isset($this->tokens[$matches[1]]) ? $this->tokens[$matches[1]] : ''; |
| 150 | 150 | }, $uri); |
| 151 | 151 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function makeMessageParameter(Message $message, Credential $credential) |
| 22 | 22 | { |
| 23 | 23 | return [ |
| 24 | - 'content' => (string) $message->getContent(), |
|
| 24 | + 'content' => (string)$message->getContent(), |
|
| 25 | 25 | 'face' => $message->getFace(), |
| 26 | 26 | 'clientid' => $credential->getClientId(), |
| 27 | 27 | 'msg_id' => $message->getMsgId(), |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
| 56 | 56 | $hash = ''; |
| 57 | 57 | for ($i = 0; $i < 8; ++$i) { |
| 58 | - $hash .= $hex[$x[$i] >> 4 & 0xf].$hex[$x[$i] & 0xf]; |
|
| 58 | + $hash .= $hex[$x[$i] >> 4 & 0xf] . $hex[$x[$i] & 0xf]; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | return $hash; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | list($s1, $s2) = explode(' ', microtime()); |
| 146 | 146 | |
| 147 | - return (float) sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); |
|
| 147 | + return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function firstByAttribute($attributeName, $attributeValue) |
| 26 | 26 | { |
| 27 | - $callback = function ($entity) use ($attributeName, $attributeValue) { |
|
| 28 | - $method = 'get'.ucfirst($attributeName); |
|
| 27 | + $callback = function($entity) use ($attributeName, $attributeValue) { |
|
| 28 | + $method = 'get' . ucfirst($attributeName); |
|
| 29 | 29 | |
| 30 | 30 | return $entity->$method() == $attributeValue; |
| 31 | 31 | }; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function __toString() |
| 51 | 51 | { |
| 52 | - return (string) $this->content->getContent(); |
|
| 52 | + return (string)$this->content->getContent(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | */ |
| 5 | 5 | use Slince\SmartQQ\Client; |
| 6 | 6 | |
| 7 | -include __DIR__.'/bootstrap.php'; |
|
| 7 | +include __DIR__ . '/bootstrap.php'; |
|
| 8 | 8 | |
| 9 | 9 | //创建smartQQ客户端 |
| 10 | 10 | $smartQQ = new Client(getCredential()); |
@@ -4,15 +4,15 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | use Slince\SmartQQ\Credential; |
| 6 | 6 | |
| 7 | -include __DIR__.'/../vendor/autoload.php'; |
|
| 7 | +include __DIR__ . '/../vendor/autoload.php'; |
|
| 8 | 8 | |
| 9 | 9 | date_default_timezone_set('Prc'); |
| 10 | 10 | |
| 11 | 11 | //二维码图片 |
| 12 | -define('LOGIN_QR_IMAGE', getcwd().'/smartqq-login-qr.png'); |
|
| 12 | +define('LOGIN_QR_IMAGE', getcwd() . '/smartqq-login-qr.png'); |
|
| 13 | 13 | |
| 14 | 14 | //登录凭证信息保存 |
| 15 | -define('CREDENTIAL_JSON', getcwd().'/credential.json'); |
|
| 15 | +define('CREDENTIAL_JSON', getcwd() . '/credential.json'); |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * 打印结果到屏幕. |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | function printPrettyScreen($data) |
| 23 | 23 | { |
| 24 | 24 | // printR($data); |
| 25 | - @file_put_contents(getcwd().'/result.log', print_r($data, true)."\r\n", FILE_APPEND); |
|
| 25 | + @file_put_contents(getcwd() . '/result.log', print_r($data, true) . "\r\n", FILE_APPEND); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | use Slince\SmartQQ\Entity\Discuss; |
| 10 | 10 | use Slince\SmartQQ\Entity\DiscussDetail; |
| 11 | 11 | |
| 12 | -include __DIR__.'/bootstrap.php'; |
|
| 12 | +include __DIR__ . '/bootstrap.php'; |
|
| 13 | 13 | |
| 14 | 14 | //创建smartQQ客户端 |
| 15 | 15 | $smartQQ = new Client(getCredential()); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | while (true) { |
| 39 | 39 | $messages = $smartQQ->pollMessages(); |
| 40 | 40 | if ($messages) { |
| 41 | - printR('收到消息'.PHP_EOL); |
|
| 41 | + printR('收到消息' . PHP_EOL); |
|
| 42 | 42 | foreach ($messages as $message) { |
| 43 | 43 | if ($message instanceof FriendMessage) { |
| 44 | 44 | $friend = $friends->firstByAttribute('uin', $message->getFromUin()); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | use Slince\SmartQQ\Message\Request\DiscussMessage; |
| 9 | 9 | use Slince\SmartQQ\Message\Content; |
| 10 | 10 | |
| 11 | -include __DIR__.'/bootstrap.php'; |
|
| 11 | +include __DIR__ . '/bootstrap.php'; |
|
| 12 | 12 | |
| 13 | 13 | //创建smartQQ客户端 |
| 14 | 14 | $smartQQ = new Client(getCredential()); |