@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $version = $this->agent->version($propertyName, $type); |
| 82 | 82 | |
| 83 | - return is_string($version) ? str_replace(['_', '+'], '.', $version) : $version; |
|
| 83 | + return is_string($version) ? str_replace([ '_', '+' ], '.', $version) : $version; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | ]; |
| 156 | 156 | |
| 157 | 157 | if ($this->agent->is('iOS')) { |
| 158 | - $info['os'] = 'iOS'; |
|
| 158 | + $info[ 'os' ] = 'iOS'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ($this->agent->is('AndroidOS')) { |
| 162 | - $info['os'] = 'Android'; |
|
| 162 | + $info[ 'os' ] = 'Android'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (is_string($this->version('MicroMessenger'))) { |
| 166 | - $info['isWechat'] = true; |
|
| 166 | + $info[ 'isWechat' ] = true; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return array_filter($info); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $this->getAppClientData($this->agent->getUserAgent()) |
| 183 | 183 | ); |
| 184 | 184 | |
| 185 | - if (! $data) { |
|
| 185 | + if (!$data) { |
|
| 186 | 186 | $this->resetAppClientAttributes(); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -198,14 +198,14 @@ discard block |
||
| 198 | 198 | protected function getAppClientData($userAgent) |
| 199 | 199 | { |
| 200 | 200 | if (preg_match('#client\((.+)\)#is', $userAgent, $matches)) { |
| 201 | - if ($info = json_decode(urlsafe_base64_decode($matches[1]), true)) { |
|
| 202 | - if (is_array($info) && ! empty($info)) { |
|
| 201 | + if ($info = json_decode(urlsafe_base64_decode($matches[ 1 ]), true)) { |
|
| 202 | + if (is_array($info) && !empty($info)) { |
|
| 203 | 203 | return $info; |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - return []; |
|
| 208 | + return [ ]; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -217,29 +217,29 @@ discard block |
||
| 217 | 217 | protected function getAppClientAttributes($info) |
| 218 | 218 | { |
| 219 | 219 | $info = array_filter($info); |
| 220 | - $data = []; |
|
| 220 | + $data = [ ]; |
|
| 221 | 221 | |
| 222 | 222 | if ( |
| 223 | - ($data['os'] = array_get($info, 'os')) && |
|
| 224 | - ($data['osVersion'] = array_get($info, 'osV')) && |
|
| 225 | - ($data['platform'] = array_get($info, 'pf')) && |
|
| 226 | - ($data['locale'] = array_get($info, 'loc')) && |
|
| 227 | - ($data['app'] = array_get($info, 'app')) && |
|
| 228 | - ($data['appVersion'] = array_get($info, 'appV')) && |
|
| 229 | - ($data['appChannel'] = array_get($info, 'appC')) && |
|
| 230 | - ($data['network'] = array_get($info, 'net')) && |
|
| 231 | - ($data['udid'] = array_get($info, 'udid')) |
|
| 223 | + ($data[ 'os' ] = array_get($info, 'os')) && |
|
| 224 | + ($data[ 'osVersion' ] = array_get($info, 'osV')) && |
|
| 225 | + ($data[ 'platform' ] = array_get($info, 'pf')) && |
|
| 226 | + ($data[ 'locale' ] = array_get($info, 'loc')) && |
|
| 227 | + ($data[ 'app' ] = array_get($info, 'app')) && |
|
| 228 | + ($data[ 'appVersion' ] = array_get($info, 'appV')) && |
|
| 229 | + ($data[ 'appChannel' ] = array_get($info, 'appC')) && |
|
| 230 | + ($data[ 'network' ] = array_get($info, 'net')) && |
|
| 231 | + ($data[ 'udid' ] = array_get($info, 'udid')) |
|
| 232 | 232 | ) { |
| 233 | - if ($data['os'] === 'iPhone OS') { |
|
| 234 | - $data['os'] = 'iOS'; |
|
| 233 | + if ($data[ 'os' ] === 'iPhone OS') { |
|
| 234 | + $data[ 'os' ] = 'iOS'; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $data['isAppClient'] = true; |
|
| 237 | + $data[ 'isAppClient' ] = true; |
|
| 238 | 238 | |
| 239 | 239 | return array_filter($data); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - return []; |
|
| 242 | + return [ ]; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -248,12 +248,12 @@ discard block |
||
| 248 | 248 | protected function resetAppClientAttributes() |
| 249 | 249 | { |
| 250 | 250 | unset( |
| 251 | - $this->attributes['app'], |
|
| 252 | - $this->attributes['appVersion'], |
|
| 253 | - $this->attributes['appChannel'], |
|
| 254 | - $this->attributes['network'], |
|
| 255 | - $this->attributes['udid'], |
|
| 256 | - $this->attributes['isAppClient'] |
|
| 251 | + $this->attributes[ 'app' ], |
|
| 252 | + $this->attributes[ 'appVersion' ], |
|
| 253 | + $this->attributes[ 'appChannel' ], |
|
| 254 | + $this->attributes[ 'network' ], |
|
| 255 | + $this->attributes[ 'udid' ], |
|
| 256 | + $this->attributes[ 'isAppClient' ] |
|
| 257 | 257 | ); |
| 258 | 258 | } |
| 259 | 259 | |
@@ -266,6 +266,6 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function __call($method, $parameters) |
| 268 | 268 | { |
| 269 | - return call_user_func_array([$this->agent, $method], $parameters); |
|
| 269 | + return call_user_func_array([ $this->agent, $method ], $parameters); |
|
| 270 | 270 | } |
| 271 | 271 | } |