@@ -26,7 +26,6 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Convert a sex string to int type. |
| 28 | 28 | * |
| 29 | - * @param mixed $string |
|
| 30 | 29 | * @return int |
| 31 | 30 | */ |
| 32 | 31 | public static function type($sex) |
@@ -43,7 +42,7 @@ discard block |
||
| 43 | 42 | /** |
| 44 | 43 | * All sex types. |
| 45 | 44 | * |
| 46 | - * @return int[] |
|
| 45 | + * @return integer[] |
|
| 47 | 46 | */ |
| 48 | 47 | public static function allTypes() |
| 49 | 48 | { |
@@ -47,6 +47,6 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public static function allTypes() |
| 49 | 49 | { |
| 50 | - return [static::MALE, static::FEMALE]; |
|
| 50 | + return [ static::MALE, static::FEMALE ]; |
|
| 51 | 51 | } |
| 52 | 52 | } |
@@ -623,7 +623,7 @@ |
||
| 623 | 623 | * Remove tags for the given device token. |
| 624 | 624 | * |
| 625 | 625 | * @param string $deviceToken |
| 626 | - * @param mixed $tags |
|
| 626 | + * @param string[] $tags |
|
| 627 | 627 | * @return bool |
| 628 | 628 | */ |
| 629 | 629 | public function removeTagsForDeviceToken($deviceToken, $tags) |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | public function encodeCustomData($data) |
| 223 | 223 | { |
| 224 | 224 | if ($this->customKey && $data) { |
| 225 | - return [$this->customKey => $data]; |
|
| 225 | + return [ $this->customKey => $data ]; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - return $data ?: []; |
|
| 228 | + return $data ?: [ ]; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | if (is_object($user)) { |
| 244 | 244 | $user = $user->id; |
| 245 | 245 | } elseif (is_array($user)) { |
| 246 | - $user = $user['id']; |
|
| 246 | + $user = $user[ 'id' ]; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return $this->accountPrefix.$user; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function accountsForUsers(array $users) |
| 259 | 259 | { |
| 260 | - return array_map([$this, 'accountForUser'], $users); |
|
| 260 | + return array_map([ $this, 'accountForUser' ], $users); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $accounts = $this->accountsForUsers($users); |
| 364 | 364 | |
| 365 | 365 | if (count($accounts) == 1) { |
| 366 | - return $this->xinge->PushSingleAccount(0, $accounts[0], $message, $this->environment); |
|
| 366 | + return $this->xinge->PushSingleAccount(0, $accounts[ 0 ], $message, $this->environment); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | return $this->xinge->PushAccountList(0, $accounts, $message, $this->environment); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | { |
| 438 | 438 | $pushIds = $this->getParameterAsArray(func_get_args()); |
| 439 | 439 | |
| 440 | - $list = $this->result($this->xinge->QueryPushStatus($pushIds), 'list', []); |
|
| 440 | + $list = $this->result($this->xinge->QueryPushStatus($pushIds), 'list', [ ]); |
|
| 441 | 441 | |
| 442 | 442 | return array_combine(array_pluck($list, 'push_id'), $list); |
| 443 | 443 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | public function queryDeviceTokensForUser($user) |
| 463 | 463 | { |
| 464 | - return $this->result($this->xinge->QueryTokensOfAccount($this->accountForUser($user)), 'tokens', []); |
|
| 464 | + return $this->result($this->xinge->QueryTokensOfAccount($this->accountForUser($user)), 'tokens', [ ]); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /** |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public function queryTagsForDeviceToken($deviceToken) |
| 542 | 542 | { |
| 543 | - return $this->result($this->xinge->QueryTokenTags($deviceToken), 'tags', []); |
|
| 543 | + return $this->result($this->xinge->QueryTokenTags($deviceToken), 'tags', [ ]); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -554,9 +554,9 @@ discard block |
||
| 554 | 554 | { |
| 555 | 555 | $deviceTokens = $this->queryDeviceTokensForUser($user); |
| 556 | 556 | |
| 557 | - $result = []; |
|
| 557 | + $result = [ ]; |
|
| 558 | 558 | foreach ($deviceTokens as $token) { |
| 559 | - $result[$token] = $this->queryTagsForDeviceToken($token); |
|
| 559 | + $result[ $token ] = $this->queryTagsForDeviceToken($token); |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | return $result; |
@@ -687,8 +687,8 @@ discard block |
||
| 687 | 687 | $tags = $this->getParameterAsArray(func_get_args(), 1); |
| 688 | 688 | $oldTags = $this->queryTagsForUser($user, $tokens); |
| 689 | 689 | |
| 690 | - $addTagTokenPairs = []; |
|
| 691 | - $removeTagTokenPairs = []; |
|
| 690 | + $addTagTokenPairs = [ ]; |
|
| 691 | + $removeTagTokenPairs = [ ]; |
|
| 692 | 692 | |
| 693 | 693 | foreach ($oldTags as $token => $tokenTags) { |
| 694 | 694 | $addTagTokenPairs = array_merge($addTagTokenPairs, |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | */ |
| 723 | 723 | protected function getParameterAsArray(array $args, $offset = 0) |
| 724 | 724 | { |
| 725 | - return is_array($args[$offset]) ? $args[$offset] : array_slice($args, $offset); |
|
| 725 | + return is_array($args[ $offset ]) ? $args[ $offset ] : array_slice($args, $offset); |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | /** |
@@ -736,12 +736,12 @@ discard block |
||
| 736 | 736 | */ |
| 737 | 737 | protected function createTagTokenPairs($tags, $tokens) |
| 738 | 738 | { |
| 739 | - $tagTokenPairs = []; |
|
| 739 | + $tagTokenPairs = [ ]; |
|
| 740 | 740 | |
| 741 | 741 | $tokens = (array) $tokens; |
| 742 | 742 | foreach ((array) $tags as $tag) { |
| 743 | 743 | foreach ($tokens as $token) { |
| 744 | - $tagTokenPairs[] = new TagTokenPair($tag, $token); |
|
| 744 | + $tagTokenPairs[ ] = new TagTokenPair($tag, $token); |
|
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | 747 | |
@@ -757,6 +757,6 @@ discard block |
||
| 757 | 757 | */ |
| 758 | 758 | public function __call($method, $parameters) |
| 759 | 759 | { |
| 760 | - return call_user_func_array([$this->xinge, $method], $parameters); |
|
| 760 | + return call_user_func_array([ $this->xinge, $method ], $parameters); |
|
| 761 | 761 | } |
| 762 | 762 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @param array|object $attributes |
| 46 | 46 | */ |
| 47 | - public function __construct($attributes = []) |
|
| 47 | + public function __construct($attributes = [ ]) |
|
| 48 | 48 | { |
| 49 | 49 | parent::__construct($attributes); |
| 50 | 50 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $version = $this->agent->version($propertyName, $type); |
| 78 | 78 | |
| 79 | - return is_string($version) ? str_replace(['_', '+'], '.', $version) : $version; |
|
| 79 | + return is_string($version) ? str_replace([ '_', '+' ], '.', $version) : $version; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | ]; |
| 144 | 144 | |
| 145 | 145 | if ((bool) $this->agent->is('iOS')) { |
| 146 | - $info['isIOS'] = true; |
|
| 146 | + $info[ 'isIOS' ] = true; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if ((bool) $this->agent->is('AndroidOS')) { |
| 150 | - $info['isAndroid'] = true; |
|
| 151 | - $info['os'] = 'Android'; |
|
| 150 | + $info[ 'isAndroid' ] = true; |
|
| 151 | + $info[ 'os' ] = 'Android'; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (is_string($this->version('MicroMessenger'))) { |
| 155 | - $info['isWechat'] = true; |
|
| 155 | + $info[ 'isWechat' ] = true; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | return array_filter($info); |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | protected function getApiClientInfo($userAgent) |
| 182 | 182 | { |
| 183 | 183 | if (preg_match('#ua\((.+)\)#is', $userAgent, $matches)) { |
| 184 | - if ($info = json_decode(urlsafe_base64_decode($matches[1]), true)) { |
|
| 184 | + if ($info = json_decode(urlsafe_base64_decode($matches[ 1 ]), true)) { |
|
| 185 | 185 | if (is_array($info) && count($info) > 0) { |
| 186 | 186 | return $info; |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return []; |
|
| 191 | + return [ ]; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -200,45 +200,45 @@ discard block |
||
| 200 | 200 | protected function getApiClientAttributes($info) |
| 201 | 201 | { |
| 202 | 202 | $info = array_filter($info); |
| 203 | - $data = []; |
|
| 203 | + $data = [ ]; |
|
| 204 | 204 | |
| 205 | 205 | if ( |
| 206 | - ($data['os'] = array_get($info, 'os')) && |
|
| 207 | - ($data['osVersion'] = array_get($info, 'osV')) && |
|
| 208 | - ($data['platform'] = array_get($info, 'pf')) && |
|
| 209 | - ($data['locale'] = array_get($info, 'loc')) && |
|
| 210 | - ($data['network'] = array_get($info, 'net')) && |
|
| 211 | - ($data['app'] = array_get($info, 'app')) && |
|
| 212 | - ($data['appVersion'] = array_get($info, 'appV')) && |
|
| 213 | - ($data['appChannel'] = array_get($info, 'appC')) && |
|
| 214 | - ($data['tdid'] = array_get($info, 'tdid')) |
|
| 206 | + ($data[ 'os' ] = array_get($info, 'os')) && |
|
| 207 | + ($data[ 'osVersion' ] = array_get($info, 'osV')) && |
|
| 208 | + ($data[ 'platform' ] = array_get($info, 'pf')) && |
|
| 209 | + ($data[ 'locale' ] = array_get($info, 'loc')) && |
|
| 210 | + ($data[ 'network' ] = array_get($info, 'net')) && |
|
| 211 | + ($data[ 'app' ] = array_get($info, 'app')) && |
|
| 212 | + ($data[ 'appVersion' ] = array_get($info, 'appV')) && |
|
| 213 | + ($data[ 'appChannel' ] = array_get($info, 'appC')) && |
|
| 214 | + ($data[ 'tdid' ] = array_get($info, 'tdid')) |
|
| 215 | 215 | ) { |
| 216 | - if ($data['os'] === 'iPhone OS') { |
|
| 217 | - $data['os'] = 'iOS'; |
|
| 216 | + if ($data[ 'os' ] === 'iPhone OS') { |
|
| 217 | + $data[ 'os' ] = 'iOS'; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $data['isIOS'] = $data['os'] === 'iOS'; |
|
| 221 | - $data['isAndroid'] = $data['os'] === 'Android'; |
|
| 220 | + $data[ 'isIOS' ] = $data[ 'os' ] === 'iOS'; |
|
| 221 | + $data[ 'isAndroid' ] = $data[ 'os' ] === 'Android'; |
|
| 222 | 222 | |
| 223 | - $data['isAppStoreChannel'] = $data['appChannel'] === 'App Store'; |
|
| 224 | - $data['isDebugChannel'] = $data['appChannel'] === 'Debug'; |
|
| 225 | - $data['isAdHocChannel'] = $data['appChannel'] === 'Ad Hoc'; |
|
| 226 | - $data['isInHouseChannel'] = $data['appChannel'] === 'In House'; |
|
| 223 | + $data[ 'isAppStoreChannel' ] = $data[ 'appChannel' ] === 'App Store'; |
|
| 224 | + $data[ 'isDebugChannel' ] = $data[ 'appChannel' ] === 'Debug'; |
|
| 225 | + $data[ 'isAdHocChannel' ] = $data[ 'appChannel' ] === 'Ad Hoc'; |
|
| 226 | + $data[ 'isInHouseChannel' ] = $data[ 'appChannel' ] === 'In House'; |
|
| 227 | 227 | |
| 228 | - $data['isAppStoreReviewing'] = ( |
|
| 229 | - $data['isIOS'] && |
|
| 230 | - $data['isAppStoreChannel'] && |
|
| 231 | - $data['appVersion'] === config('var.ios.app_store_reviewing_version') |
|
| 228 | + $data[ 'isAppStoreReviewing' ] = ( |
|
| 229 | + $data[ 'isIOS' ] && |
|
| 230 | + $data[ 'isAppStoreChannel' ] && |
|
| 231 | + $data[ 'appVersion' ] === config('var.ios.app_store_reviewing_version') |
|
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | - $data['isApiClient'] = true; |
|
| 234 | + $data[ 'isApiClient' ] = true; |
|
| 235 | 235 | |
| 236 | 236 | return array_filter($data); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $this->resetApiClientAttributes(); |
| 240 | 240 | |
| 241 | - return []; |
|
| 241 | + return [ ]; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -247,16 +247,16 @@ discard block |
||
| 247 | 247 | protected function resetApiClientAttributes() |
| 248 | 248 | { |
| 249 | 249 | unset( |
| 250 | - $this->attributes['network'], |
|
| 251 | - $this->attributes['app'], |
|
| 252 | - $this->attributes['appVersion'], |
|
| 253 | - $this->attributes['appChannel'], |
|
| 254 | - $this->attributes['tdid'], |
|
| 255 | - $this->attributes['isAppStoreChannel'], |
|
| 256 | - $this->attributes['isDebugChannel'], |
|
| 257 | - $this->attributes['isAdHocChannel'], |
|
| 258 | - $this->attributes['isInHouseChannel'], |
|
| 259 | - $this->attributes['isAppStoreReviewing'] |
|
| 250 | + $this->attributes[ 'network' ], |
|
| 251 | + $this->attributes[ 'app' ], |
|
| 252 | + $this->attributes[ 'appVersion' ], |
|
| 253 | + $this->attributes[ 'appChannel' ], |
|
| 254 | + $this->attributes[ 'tdid' ], |
|
| 255 | + $this->attributes[ 'isAppStoreChannel' ], |
|
| 256 | + $this->attributes[ 'isDebugChannel' ], |
|
| 257 | + $this->attributes[ 'isAdHocChannel' ], |
|
| 258 | + $this->attributes[ 'isInHouseChannel' ], |
|
| 259 | + $this->attributes[ 'isAppStoreReviewing' ] |
|
| 260 | 260 | ); |
| 261 | 261 | } |
| 262 | 262 | |
@@ -269,6 +269,6 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function __call($method, $parameters) |
| 271 | 271 | { |
| 272 | - return call_user_func_array([$this->agent, $method], $parameters); |
|
| 272 | + return call_user_func_array([ $this->agent, $method ], $parameters); |
|
| 273 | 273 | } |
| 274 | 274 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
| 14 | - protected $only = []; |
|
| 14 | + protected $only = [ ]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Enable encryption for the given cookie name(s). |
@@ -32,6 +32,6 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function isDisabled($name) |
| 34 | 34 | { |
| 35 | - return ! in_array($name, $this->only); |
|
| 35 | + return !in_array($name, $this->only); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function offsetExists($offset) |
| 23 | 23 | { |
| 24 | - return isset($this->attributes[$offset]); |
|
| 24 | + return isset($this->attributes[ $offset ]); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function offsetSet($offset, $value) |
| 46 | 46 | { |
| 47 | - $this->attributes[$offset] = $value; |
|
| 47 | + $this->attributes[ $offset ] = $value; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,6 +55,6 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function offsetUnset($offset) |
| 57 | 57 | { |
| 58 | - unset($this->attributes[$offset]); |
|
| 58 | + unset($this->attributes[ $offset ]); |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | protected static function bootFreshCreatedAt() |
| 28 | 28 | { |
| 29 | - static::creating(function ($model) { |
|
| 29 | + static::creating(function($model) { |
|
| 30 | 30 | $model->setCreatedAt($model->freshTimestamp()); |
| 31 | 31 | }); |
| 32 | 32 | } |
@@ -24,6 +24,6 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function setSexAttribute($value) |
| 26 | 26 | { |
| 27 | - $this->attributes['sex'] = Sex::type($value); |
|
| 27 | + $this->attributes[ 'sex' ] = Sex::type($value); |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | protected function storeImageFile($file, $identifier = null) |
| 22 | 22 | { |
| 23 | - if ($file instanceof UploadedFile && ! $file->isValid()) { |
|
| 23 | + if ($file instanceof UploadedFile && !$file->isValid()) { |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function __call($method, $parameters) |
| 18 | 18 | { |
| 19 | 19 | if (property_exists($this, $method) && count($parameters) > 0) { |
| 20 | - $this->{$method} = $parameters[0]; |
|
| 20 | + $this->{$method} = $parameters[ 0 ]; |
|
| 21 | 21 | |
| 22 | 22 | return $this; |
| 23 | 23 | } |