@@ -20,8 +20,8 @@ |
||
| 20 | 20 | |
| 21 | 21 | $protocol = (!empty($_SERVER['HTTPS']) |
| 22 | 22 | && $_SERVER['HTTPS'] !== 'off' |
| 23 | - || (int)$_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://'; |
|
| 23 | + || (int) $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://'; |
|
| 24 | 24 | |
| 25 | - return $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 25 | + return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | { |
| 58 | 58 | $className = basename(str_replace('\\', '/', static::class)); |
| 59 | 59 | |
| 60 | - $name = Str::snake($className) . '.' . $key; |
|
| 60 | + $name = Str::snake($className).'.'.$key; |
|
| 61 | 61 | |
| 62 | 62 | return $this->container->offsetGet($name); |
| 63 | 63 | } |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | foreach ($array as $key => $value) { |
| 78 | 78 | if (is_array($value)) { |
| 79 | - $results = array_merge($results, static::dot($value, $prepend . $key . '.')); |
|
| 79 | + $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
|
| 80 | 80 | } else { |
| 81 | - $results[$prepend . $key] = $value; |
|
| 81 | + $results[$prepend.$key] = $value; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public static function except($array, $keys) |
| 97 | 97 | { |
| 98 | - return array_diff_key($array, array_flip((array)$keys)); |
|
| 98 | + return array_diff_key($array, array_flip((array) $keys)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | foreach (explode('.', $key) as $segment) { |
| 114 | 114 | $results = []; |
| 115 | 115 | foreach ($array as $value) { |
| 116 | - $value = (array)$value; |
|
| 116 | + $value = (array) $value; |
|
| 117 | 117 | $results[] = $value[$segment]; |
| 118 | 118 | } |
| 119 | 119 | $array = array_values($results); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $return = []; |
| 169 | 169 | array_walk_recursive( |
| 170 | 170 | $array, |
| 171 | - function ($x) use (&$return) { |
|
| 171 | + function($x) use (&$return) { |
|
| 172 | 172 | $return[] = $x; |
| 173 | 173 | } |
| 174 | 174 | ); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $original = &$array; |
| 188 | 188 | |
| 189 | - foreach ((array)$keys as $key) { |
|
| 189 | + foreach ((array) $keys as $key) { |
|
| 190 | 190 | $parts = explode('.', $key); |
| 191 | 191 | while (count($parts) > 1) { |
| 192 | 192 | $part = array_shift($parts); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public static function only($array, $keys) |
| 241 | 241 | { |
| 242 | - return array_intersect_key($array, array_flip((array)$keys)); |
|
| 242 | + return array_intersect_key($array, array_flip((array) $keys)); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -142,14 +142,14 @@ |
||
| 142 | 142 | */ |
| 143 | 143 | public static function snake($value, $delimiter = '_') |
| 144 | 144 | { |
| 145 | - $key = $value . $delimiter; |
|
| 145 | + $key = $value.$delimiter; |
|
| 146 | 146 | |
| 147 | 147 | if (isset(static::$snakeCache[$key])) { |
| 148 | 148 | return static::$snakeCache[$key]; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (!ctype_lower($value)) { |
| 152 | - $value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1' . $delimiter, $value)); |
|
| 152 | + $value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.$delimiter, $value)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return static::$snakeCache[$key] = $value; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $result = null; |
| 85 | 85 | |
| 86 | 86 | if (is_object($obj)) { |
| 87 | - $obj = (array)$obj; |
|
| 87 | + $obj = (array) $obj; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if (is_array($obj)) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $xml .= "<{$key}{$attr}>"; |
| 126 | 126 | |
| 127 | 127 | if ((is_array($val) || is_object($val))) { |
| 128 | - $xml .= self::data2Xml((array)$val, $item, $id); |
|
| 128 | + $xml .= self::data2Xml((array) $val, $item, $id); |
|
| 129 | 129 | } else { |
| 130 | 130 | $xml .= is_numeric($val) ? $val : self::cdata($val); |
| 131 | 131 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class Authorization |
| 10 | 10 | { |
| 11 | - const CACHE_KEY_ACCESS_TOKEN = 'EntWeChat.suite.authorizer_access_token'; |
|
| 11 | + const CACHE_KEY_ACCESS_TOKEN = 'EntWeChat.suite.authorizer_access_token'; |
|
| 12 | 12 | const CACHE_KEY_PERMANENT_CODE = 'EntWeChat.suite.authorizer_permanent_code'; |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getAuthorizerAccessTokenKey() |
| 84 | 84 | { |
| 85 | - return self::CACHE_KEY_ACCESS_TOKEN . $this->suiteId . $this->getAuthorizerCorpId(); |
|
| 85 | + return self::CACHE_KEY_ACCESS_TOKEN.$this->suiteId.$this->getAuthorizerCorpId(); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function getAuthorizerPermanentCodeKey() |
| 148 | 148 | { |
| 149 | - return self::CACHE_KEY_PERMANENT_CODE . $this->suiteId . $this->getAuthorizerCorpId(); |
|
| 149 | + return self::CACHE_KEY_PERMANENT_CODE.$this->suiteId.$this->getAuthorizerCorpId(); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $token = $http->parseJSON($http->json(self::API_TOKEN_GET, $data)); |
| 63 | 63 | |
| 64 | 64 | if (empty($token[$this->tokenJsonKey])) { |
| 65 | - throw new HttpException('Request SuiteAccessToken fail. response: ' . json_encode($token, JSON_UNESCAPED_UNICODE)); |
|
| 65 | + throw new HttpException('Request SuiteAccessToken fail. response: '.json_encode($token, JSON_UNESCAPED_UNICODE)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $token; |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | public function getCacheKey() |
| 66 | 66 | { |
| 67 | 67 | if (is_null($this->cacheKey)) { |
| 68 | - return $this->prefix . $this->suiteId; |
|
| 68 | + return $this->prefix.$this->suiteId; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return $this->cacheKey; |
@@ -22,11 +22,11 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function register(Container $pimple) |
| 24 | 24 | { |
| 25 | - $pimple['oauth'] = function ($pimple) { |
|
| 25 | + $pimple['oauth'] = function($pimple) { |
|
| 26 | 26 | return new App($pimple['access_token']); |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | - $pimple['auth'] = function ($pimple) { |
|
| 29 | + $pimple['auth'] = function($pimple) { |
|
| 30 | 30 | return new Web($pimple['access_token']); |
| 31 | 31 | }; |
| 32 | 32 | } |