@@ -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 | } |
@@ -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 | }; |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | { |
| 113 | 113 | //获取二维码资源 |
| 114 | 114 | $response = $this->sendRequest(new Request\GetQrCodeRequest()); |
| 115 | - call_user_func($this->callback, (string) $response->getBody()); |
|
| 115 | + call_user_func($this->callback, (string)$response->getBody()); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | if (!is_callable($handler)) { |
| 74 | 74 | throw new InvalidArgumentException('Message handler should be callable.'); |
| 75 | 75 | } |
| 76 | - $this->eventDispatcher->addListener(static::EVENT_MESSAGE, function (Event $event) use ($handler) { |
|
| 76 | + $this->eventDispatcher->addListener(static::EVENT_MESSAGE, function(Event $event) use ($handler) { |
|
| 77 | 77 | $handler($event->getArgument('message')); |
| 78 | 78 | }); |
| 79 | 79 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public static function createEntities($entityClass, $dataArray) |
| 24 | 24 | { |
| 25 | - return array_map(function ($data) use ($entityClass) { |
|
| 25 | + return array_map(function($data) use ($entityClass) { |
|
| 26 | 26 | return static::createEntity($entityClass, $data); |
| 27 | 27 | }, $dataArray); |
| 28 | 28 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | protected static function applyProperties($entityInstance, $data) |
| 55 | 55 | { |
| 56 | 56 | foreach ($data as $property => $value) { |
| 57 | - $funcName = 'set'.ucfirst($property); |
|
| 57 | + $funcName = 'set' . ucfirst($property); |
|
| 58 | 58 | if (method_exists($entityInstance, $funcName)) { |
| 59 | 59 | $entityInstance->$funcName($value); |
| 60 | 60 | } |
@@ -49,19 +49,19 @@ |
||
| 49 | 49 | //有时候获取好友接口retcode=100003时也可以获取数据,但数据不完整故当做无效返回 |
| 50 | 50 | if ($jsonData && 0 == $jsonData['retcode']) { |
| 51 | 51 | //好友基本信息 |
| 52 | - $friendDatas = (new Collection($jsonData['result']['friends']))->combine('uin', function ($entity) { |
|
| 52 | + $friendDatas = (new Collection($jsonData['result']['friends']))->combine('uin', function($entity) { |
|
| 53 | 53 | return $entity; |
| 54 | 54 | })->toArray(); |
| 55 | 55 | //markNames |
| 56 | - $markNames = (new Collection($jsonData['result']['marknames']))->combine('uin', function ($entity) { |
|
| 56 | + $markNames = (new Collection($jsonData['result']['marknames']))->combine('uin', function($entity) { |
|
| 57 | 57 | return $entity; |
| 58 | 58 | })->toArray(); |
| 59 | 59 | //分类 |
| 60 | - $categories = (new Collection($jsonData['result']['categories']))->combine('index', function ($entity) { |
|
| 60 | + $categories = (new Collection($jsonData['result']['categories']))->combine('index', function($entity) { |
|
| 61 | 61 | return $entity; |
| 62 | 62 | })->toArray(); |
| 63 | 63 | //vip信息 |
| 64 | - $vipInfos = (new Collection($jsonData['result']['vipinfo']))->combine('u', function ($entity) { |
|
| 64 | + $vipInfos = (new Collection($jsonData['result']['vipinfo']))->combine('u', function($entity) { |
|
| 65 | 65 | return $entity; |
| 66 | 66 | })->toArray(); |
| 67 | 67 | $friends = []; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $jsonData = \GuzzleHttp\json_decode($response->getBody(), true); |
| 44 | 44 | if ($jsonData && 0 == $jsonData['retcode']) { |
| 45 | - $info = (new Collection($jsonData['result']))->filter(function ($info) use ($friend) { |
|
| 45 | + $info = (new Collection($jsonData['result']))->filter(function($info) use ($friend) { |
|
| 46 | 46 | return $info['uin'] == $friend->getUin(); |
| 47 | 47 | })->first(); |
| 48 | 48 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $jsonData = \GuzzleHttp\json_decode($response->getBody(), true); |
| 48 | 48 | if ($jsonData && 0 == $jsonData['retcode']) { |
| 49 | 49 | //成员在线状态 |
| 50 | - $statuses = (new Collection($jsonData['result']['mem_status']))->combine('uin', function ($entity) { |
|
| 50 | + $statuses = (new Collection($jsonData['result']['mem_status']))->combine('uin', function($entity) { |
|
| 51 | 51 | return $entity; |
| 52 | 52 | })->toArray(); |
| 53 | 53 | //成员基本信息 |
@@ -129,13 +129,13 @@ |
||
| 129 | 129 | $fontParameters['style'] |
| 130 | 130 | ); |
| 131 | 131 | unset($contents[0]); |
| 132 | - $contentString = implode('', array_map(function ($content) { |
|
| 132 | + $contentString = implode('', array_map(function($content) { |
|
| 133 | 133 | if ($content && is_array($content) && 'face' === $content[0]) { //处理表情 |
| 134 | 134 | $faceText = Content::searchFaceText($content[1]); |
| 135 | 135 | |
| 136 | - return $faceText ? '['.$faceText.']' : ''; |
|
| 136 | + return $faceText ? '[' . $faceText . ']' : ''; |
|
| 137 | 137 | } else { |
| 138 | - return (string) $content; |
|
| 138 | + return (string)$content; |
|
| 139 | 139 | } |
| 140 | 140 | }, $contents)); |
| 141 | 141 | |