@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if (!is_array($this->endpoints) || empty($this->endpoints)) { |
| 75 | 75 | $endpoint = new Endpoint($this->config->getEndpoint(), null); |
| 76 | 76 | |
| 77 | - $this->endpoints = []; |
|
| 77 | + $this->endpoints = [ ]; |
|
| 78 | 78 | $response = $this->sendRequest("GET", $endpoint->makeUrl(static::GET_SERVER)); |
| 79 | 79 | foreach (explode("\n", $response->getBody()->getContents()) as $server) { |
| 80 | 80 | $server = trim($server); |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $parts = explode(":", $server); |
| 86 | - $parts[1] = (isset($parts[1]) && $parts[1]) ? $parts[1] : null; |
|
| 87 | - $this->endpoints[] = new Endpoint($parts[0], $parts[1]); |
|
| 86 | + $parts[ 1 ] = (isset($parts[ 1 ]) && $parts[ 1 ]) ? $parts[ 1 ] : null; |
|
| 87 | + $this->endpoints[ ] = new Endpoint($parts[ 0 ], $parts[ 1 ]); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $endpoints = $this->getEndpoints(); |
| 111 | 111 | $key = array_rand($endpoints, 1); |
| 112 | 112 | |
| 113 | - return $endpoints[$key]->makeUrl($path); |
|
| 113 | + return $endpoints[ $key ]->makeUrl($path); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | private function signatureHandler() |
| 139 | 139 | { |
| 140 | - return function (callable $handler) { |
|
| 141 | - return function (RequestInterface $request, array $options) use ($handler) { |
|
| 140 | + return function(callable $handler) { |
|
| 141 | + return function(RequestInterface $request, array $options) use ($handler) { |
|
| 142 | 142 | $request = $request |
| 143 | 143 | ->withHeader("timeStamp", time() * 1000) |
| 144 | 144 | ->withHeader("Spas-AccessKey", $this->getConfig()->getAccessKey()); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @return \Psr\Http\Message\ResponseInterface |
| 168 | 168 | * @throws HttpException |
| 169 | 169 | */ |
| 170 | - protected function sendRequest($method, Url $uri, array $params = [], array $options = []) |
|
| 170 | + protected function sendRequest($method, Url $uri, array $params = [ ], array $options = [ ]) |
|
| 171 | 171 | { |
| 172 | 172 | $params = array_merge($params, [ |
| 173 | 173 | "tenant" => $this->getConfig()->getNamespace(), |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | if ("POST" === strtoupper($method) && !empty($params)) { |
| 184 | - $options[RequestOptions::FORM_PARAMS] = $params; |
|
| 184 | + $options[ RequestOptions::FORM_PARAMS ] = $params; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | try { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $response = $this->sendRequest( |
| 206 | 206 | "GET", |
| 207 | 207 | $this->makeUrl(static::GET_CONFIG), |
| 208 | - ["dataId" => $dataId] |
|
| 208 | + [ "dataId" => $dataId ] |
|
| 209 | 209 | ); |
| 210 | 210 | |
| 211 | 211 | return $response->getBody()->getContents(); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $response = $this->sendRequest( |
| 225 | 225 | "POST", |
| 226 | 226 | $this->makeUrl(static::SET_CONFIG), |
| 227 | - ["dataId" => $dataId, "content" => $content] |
|
| 227 | + [ "dataId" => $dataId, "content" => $content ] |
|
| 228 | 228 | ); |
| 229 | 229 | |
| 230 | 230 | return 200 == $response->getStatusCode(); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $response = $this->sendRequest( |
| 243 | 243 | "POST", |
| 244 | 244 | $this->makeUrl(static::DEL_CONFIG), |
| 245 | - ["dataId" => $dataId] |
|
| 245 | + [ "dataId" => $dataId ] |
|
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | 248 | return 200 == $response->getStatusCode(); |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function watch(string $dataId, string $content) |
| 260 | 260 | { |
| 261 | - $wordDelimiter = chr(37) . chr(48) . chr(50); |
|
| 262 | - $lineDelimiter = chr(37) . chr(48) . chr(49); |
|
| 261 | + $wordDelimiter = chr(37).chr(48).chr(50); |
|
| 262 | + $lineDelimiter = chr(37).chr(48).chr(49); |
|
| 263 | 263 | |
| 264 | 264 | $args = [ |
| 265 | 265 | $dataId, |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | "POST", |
| 273 | 273 | $this->makeUrl(static::GET_CONFIG), |
| 274 | 274 | [ |
| 275 | - "Probe-Modify-Request" => implode($wordDelimiter, $args) . $lineDelimiter |
|
| 275 | + "Probe-Modify-Request" => implode($wordDelimiter, $args).$lineDelimiter |
|
| 276 | 276 | ] |
| 277 | 277 | ); |
| 278 | 278 | |
@@ -87,6 +87,6 @@ |
||
| 87 | 87 | return null; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - return md5($contents) . '-' . crc32($contents);; |
|
| 90 | + return md5($contents).'-'.crc32($contents); ; |
|
| 91 | 91 | } |
| 92 | 92 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @var Client[] |
| 32 | 32 | */ |
| 33 | - protected $connections = []; |
|
| 33 | + protected $connections = [ ]; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Create a new Redis manager instance. |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $name = null == $name ? 'default' : $name; |
| 58 | 58 | |
| 59 | - if (isset($this->connections[$name])) { |
|
| 60 | - return $this->connections[$name]; |
|
| 59 | + if (isset($this->connections[ $name ])) { |
|
| 60 | + return $this->connections[ $name ]; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - return $this->connections[$name] = $this->resolve($name); |
|
| 63 | + return $this->connections[ $name ] = $this->resolve($name); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $name = $name ?: 'default'; |
| 77 | 77 | |
| 78 | - if (isset($this->config[$name])) { |
|
| 78 | + if (isset($this->config[ $name ])) { |
|
| 79 | 79 | $config = (new Config())->setNamespace($this->getConfigValue($name, "namespace")) |
| 80 | 80 | ->setGroupName($this->getConfigValue($name, "groupName")) |
| 81 | 81 | ->setAccessKey($this->getConfigValue($name, "accessKey")) |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | protected function getConfigValue($name, $key, $default = null) |
| 91 | 91 | { |
| 92 | - if (isset($this->config[$name], $this->config[$name][$key])) { |
|
| 93 | - return $this->config[$name][$key]; |
|
| 92 | + if (isset($this->config[ $name ], $this->config[ $name ][ $key ])) { |
|
| 93 | + return $this->config[ $name ][ $key ]; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $options = $this->config['options'] ?? []; |
|
| 97 | - if (isset($options[$key])) { |
|
| 98 | - return $options[$key]; |
|
| 96 | + $options = $this->config[ 'options' ] ?? [ ]; |
|
| 97 | + if (isset($options[ $key ])) { |
|
| 98 | + return $options[ $key ]; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $default; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function boot() |
| 26 | 26 | { |
| 27 | - $source = realpath($raw = __DIR__ . '/../config/acm.php') ?: $raw; |
|
| 27 | + $source = realpath($raw = __DIR__.'/../config/acm.php') ?: $raw; |
|
| 28 | 28 | |
| 29 | 29 | if ($this->app instanceof LumenApplication) { |
| 30 | 30 | $this->app->configure('acm'); |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function register() |
| 45 | 45 | { |
| 46 | - $this->app->singleton('acm', function ($app) { |
|
| 47 | - $config = $app->make('config')->get('acm', []); |
|
| 46 | + $this->app->singleton('acm', function($app) { |
|
| 47 | + $config = $app->make('config')->get('acm', [ ]); |
|
| 48 | 48 | |
| 49 | 49 | return new Manager($app, $config); |
| 50 | 50 | }); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function provides() |
| 63 | 63 | { |
| 64 | - return []; |
|
| 64 | + return [ ]; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | ]; |
| 77 | 77 | |
| 78 | 78 | foreach ($commands as $command) { |
| 79 | - $this->app->singleton($command, function () use ($command) { |
|
| 79 | + $this->app->singleton($command, function() use ($command) { |
|
| 80 | 80 | return new $command(); |
| 81 | 81 | }); |
| 82 | - $this->commands([$command]); |
|
| 82 | + $this->commands([ $command ]); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |