@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | if ($value === false) { |
132 | 132 | continue; |
133 | 133 | } |
134 | - $passOptionStr .= sprintf('--%s%s ', $key, is_bool($value) ? '' : ('=' . $value)); |
|
134 | + $passOptionStr .= sprintf('--%s%s ', $key, is_bool($value) ? '' : ('='.$value)); |
|
135 | 135 | } |
136 | - $statusCode = $this->runArtisanCommand(trim('laravels config ' . $passOptionStr)); |
|
136 | + $statusCode = $this->runArtisanCommand(trim('laravels config '.$passOptionStr)); |
|
137 | 137 | if ($statusCode !== 0) { |
138 | 138 | return $statusCode; |
139 | 139 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $config = $this->getConfig(); |
143 | 143 | |
144 | 144 | if (!$config['server']['ignore_check_pid'] && file_exists($config['server']['swoole']['pid_file'])) { |
145 | - $pid = (int)file_get_contents($config['server']['swoole']['pid_file']); |
|
145 | + $pid = (int) file_get_contents($config['server']['swoole']['pid_file']); |
|
146 | 146 | if ($pid > 0 && self::kill($pid, 0)) { |
147 | 147 | $this->warning(sprintf('Swoole[PID=%d] is already running.', $pid)); |
148 | 148 | return 1; |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $basePath = dirname($pidFile); |
195 | 195 | $deleteFiles = [ |
196 | 196 | $pidFile, |
197 | - $basePath . '/laravels-custom-processes.pid', |
|
198 | - $basePath . '/laravels-timer-process.pid', |
|
197 | + $basePath.'/laravels-custom-processes.pid', |
|
198 | + $basePath.'/laravels-timer-process.pid', |
|
199 | 199 | ]; |
200 | 200 | foreach ($deleteFiles as $deleteFile) { |
201 | 201 | if (file_exists($deleteFile)) { |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | // Reload custom processes |
240 | - $pidFile = dirname($pidFile) . '/laravels-custom-processes.pid'; |
|
240 | + $pidFile = dirname($pidFile).'/laravels-custom-processes.pid'; |
|
241 | 241 | if (file_exists($pidFile)) { |
242 | - $pids = (array)explode("\n", trim(file_get_contents($pidFile))); |
|
242 | + $pids = (array) explode("\n", trim(file_get_contents($pidFile))); |
|
243 | 243 | unlink($pidFile); |
244 | 244 | foreach ($pids as $pid) { |
245 | 245 | if (!$pid || !self::kill($pid, 0)) { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | // Reload timer process |
259 | 259 | if (!empty($config['server']['timer']['enable']) && !empty($config['server']['timer']['jobs'])) { |
260 | - $pidFile = dirname($pidFile) . '/laravels-timer-process.pid'; |
|
260 | + $pidFile = dirname($pidFile).'/laravels-timer-process.pid'; |
|
261 | 261 | $pid = file_get_contents($pidFile); |
262 | 262 | if (!$pid || !self::kill($pid, 0)) { |
263 | 263 | $this->error("Timer process[PID={$pid}] does not exist, or permission denied."); |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | public function loadApollo(array $options) |
282 | 282 | { |
283 | 283 | Client::putCommandOptionsToEnv($options); |
284 | - $envFile = $this->basePath . '/.env'; |
|
284 | + $envFile = $this->basePath.'/.env'; |
|
285 | 285 | if (isset($options['env'])) { |
286 | - $envFile .= '.' . $options['env']; |
|
286 | + $envFile .= '.'.$options['env']; |
|
287 | 287 | } |
288 | 288 | Client::createFromCommandOptions($options)->pullAllAndSave($envFile); |
289 | 289 | } |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | |
305 | 305 | public function getConfig() |
306 | 306 | { |
307 | - return unserialize((string)file_get_contents($this->getConfPath())); |
|
307 | + return unserialize((string) file_get_contents($this->getConfPath())); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | protected function getConfPath() |
311 | 311 | { |
312 | - return $this->basePath . '/storage/laravels.conf'; |
|
312 | + return $this->basePath.'/storage/laravels.conf'; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | public static function runCommand($cmd, $input = null) |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | public static function kill($pid, $sig) |
331 | 331 | { |
332 | 332 | try { |
333 | - return Process::kill((int)$pid, $sig); |
|
333 | + return Process::kill((int) $pid, $sig); |
|
334 | 334 | } catch (\Exception $e) { |
335 | 335 | return false; |
336 | 336 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $parts = parse_url($url); |
32 | 32 | $path = isset($parts['path']) ? $parts['path'] : '/'; |
33 | 33 | if (isset($parts['query'])) { |
34 | - $path .= '?' . $parts['query']; |
|
34 | + $path .= '?'.$parts['query']; |
|
35 | 35 | } |
36 | 36 | if (isset($parts['fragment'])) { |
37 | - $path .= '#' . $parts['fragment']; |
|
37 | + $path .= '#'.$parts['fragment']; |
|
38 | 38 | } |
39 | 39 | $client = new CoroutineClient($parts['host'], isset($parts['port']) ? $parts['port'] : 80, isset($parts['scheme']) && $parts['scheme'] === 'https'); |
40 | 40 | if (isset($options['timeout'])) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | if (isset($headers[$key])) { |
93 | - $headers[$key] = (array)$headers[$key]; |
|
93 | + $headers[$key] = (array) $headers[$key]; |
|
94 | 94 | $headers[$key][] = isset($middle[1]) ? trim($middle[1]) : ''; |
95 | 95 | } else { |
96 | 96 | $headers[$key] = isset($middle[1]) ? trim($middle[1]) : ''; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function getEurekaUri() |
21 | 21 | { |
22 | - return $this->host . ':' . $this->port . '/' . $this->context; |
|
22 | + return $this->host.':'.$this->port.'/'.$this->context; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function register($appId, array $data) |
33 | 33 | { |
34 | - return $this->client->request('POST', $this->getEurekaUri() . '/apps/' . $appId, [ |
|
34 | + return $this->client->request('POST', $this->getEurekaUri().'/apps/'.$appId, [ |
|
35 | 35 | 'json' => [ |
36 | 36 | 'instance' => $data, |
37 | 37 | ], |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function deRegister($appId, $instanceId) |
52 | 52 | { |
53 | - return $this->client->request('DELETE', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId); |
|
53 | + return $this->client->request('DELETE', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function heartBeat($appId, $instanceId) |
67 | 67 | { |
68 | - return $this->client->request('PUT', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId); |
|
68 | + return $this->client->request('PUT', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getAllApps() |
79 | 79 | { |
80 | - $response = $this->client->request('GET', $this->getEurekaUri() . '/apps', [ |
|
80 | + $response = $this->client->request('GET', $this->getEurekaUri().'/apps', [ |
|
81 | 81 | 'headers' => [ |
82 | 82 | 'Accept' => 'application/json', |
83 | 83 | ], |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function getApp($appId) |
99 | 99 | { |
100 | - $response = $this->client->request('GET', $this->getEurekaUri() . '/apps/' . $appId, [ |
|
100 | + $response = $this->client->request('GET', $this->getEurekaUri().'/apps/'.$appId, [ |
|
101 | 101 | 'headers' => [ |
102 | 102 | 'Accept' => 'application/json', |
103 | 103 | ], |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getAppInstance($appId, $instanceId) |
120 | 120 | { |
121 | - $response = $this->client->request('GET', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId, [ |
|
121 | + $response = $this->client->request('GET', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId, [ |
|
122 | 122 | 'headers' => [ |
123 | 123 | 'Accept' => 'application/json', |
124 | 124 | ], |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getInstance($instanceId) |
140 | 140 | { |
141 | - $response = $this->client->request('GET', $this->getEurekaUri() . '/instances/' . $instanceId, [ |
|
141 | + $response = $this->client->request('GET', $this->getEurekaUri().'/instances/'.$instanceId, [ |
|
142 | 142 | 'headers' => [ |
143 | 143 | 'Accept' => 'application/json', |
144 | 144 | ], |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function takeInstanceOut($appId, $instanceId) |
159 | 159 | { |
160 | - return $this->client->request('PUT', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId . '/status', [ |
|
160 | + return $this->client->request('PUT', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId.'/status', [ |
|
161 | 161 | 'query' => [ |
162 | 162 | 'value' => 'OUT_OF_SERVICE', |
163 | 163 | ], |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function putInstanceBack($appId, $instanceId) |
178 | 178 | { |
179 | - return $this->client->request('PUT', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId . '/status', [ |
|
179 | + return $this->client->request('PUT', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId.'/status', [ |
|
180 | 180 | 'query' => [ |
181 | 181 | 'value' => 'UP', |
182 | 182 | ], |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function updateAppInstanceMetadata($appId, $instanceId, array $metadata) |
198 | 198 | { |
199 | - return $this->client->request('PUT', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId . '/metadata', [ |
|
199 | + return $this->client->request('PUT', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId.'/metadata', [ |
|
200 | 200 | 'query' => $metadata, |
201 | 201 | ]); |
202 | 202 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getInstancesByVipAddress($vipAddress) |
211 | 211 | { |
212 | - $response = $this->client->request('GET', $this->getEurekaUri() . '/vips/' . $vipAddress, [ |
|
212 | + $response = $this->client->request('GET', $this->getEurekaUri().'/vips/'.$vipAddress, [ |
|
213 | 213 | 'headers' => [ |
214 | 214 | 'Accept' => 'application/json', |
215 | 215 | ], |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getInstancesBySecureVipAddress($secureVipAddress) |
227 | 227 | { |
228 | - $response = $this->client->request('GET', $this->getEurekaUri() . '/svips/' . $secureVipAddress, [ |
|
228 | + $response = $this->client->request('GET', $this->getEurekaUri().'/svips/'.$secureVipAddress, [ |
|
229 | 229 | 'headers' => [ |
230 | 230 | 'Accept' => 'application/json', |
231 | 231 | ], |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | public function up(string $appId, string $instanceId) |
238 | 238 | { |
239 | - return $this->client->request('PUT', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId . '/status', [ |
|
239 | + return $this->client->request('PUT', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId.'/status', [ |
|
240 | 240 | 'query' => [ |
241 | 241 | 'value' => 'UP', |
242 | 242 | ], |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | public function down($appId, $instanceId) |
247 | 247 | { |
248 | - return $this->client->request('PUT', $this->getEurekaUri() . '/apps/' . $appId . '/' . $instanceId . '/status', [ |
|
248 | + return $this->client->request('PUT', $this->getEurekaUri().'/apps/'.$appId.'/'.$instanceId.'/status', [ |
|
249 | 249 | 'query' => [ |
250 | 250 | 'value' => 'DOWN', |
251 | 251 | ], |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function getUpInstances($appId) |
262 | 262 | { |
263 | 263 | $apps = $this->getApp($appId); |
264 | - return array_filter($apps['application']['instance'], function ($instance) { |
|
264 | + return array_filter($apps['application']['instance'], function($instance) { |
|
265 | 265 | return $instance['status'] === 'UP'; |
266 | 266 | }); |
267 | 267 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } else { |
281 | 281 | $parts = parse_url($instance['homePageUrl']); |
282 | 282 | if (!isset($parts['host'])) { |
283 | - throw new \RuntimeException('Invalid homePageUrl: ' . $instance['homePageUrl']); |
|
283 | + throw new \RuntimeException('Invalid homePageUrl: '.$instance['homePageUrl']); |
|
284 | 284 | } |
285 | 285 | $url = sprintf('%s://%s:%d', isset($parts['scheme']) ? $parts['scheme'] : 'http', $parts['host'], isset($parts['port']) ? $parts['port'] : 80); |
286 | 286 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $server[$headerServerMapping[$key]] = $value; |
52 | 52 | } else { |
53 | 53 | $key = str_replace('-', '_', $key); |
54 | - $server['http_' . $key] = $value; |
|
54 | + $server['http_'.$key] = $value; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | $server = array_change_key_case($server, CASE_UPPER); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | && isset($_SERVER['QUERY_STRING']) |
66 | 66 | && $_SERVER['QUERY_STRING'] !== '' |
67 | 67 | ) { |
68 | - $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
68 | + $_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING']; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Fix argv & argc |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | self::autoload($this->conf['root_path']); |
79 | 79 | |
80 | 80 | // Make kernel for Laravel |
81 | - $app = require $this->conf['root_path'] . '/bootstrap/app.php'; |
|
81 | + $app = require $this->conf['root_path'].'/bootstrap/app.php'; |
|
82 | 82 | $kernel = $this->isLumen() ? null : $app->make(HttpKernel::class); |
83 | 83 | |
84 | 84 | // Load all Configurations for Lumen |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | { |
103 | 103 | $cfgPaths = [ |
104 | 104 | // Framework default configuration |
105 | - $this->conf['root_path'] . '/vendor/laravel/lumen-framework/config/', |
|
105 | + $this->conf['root_path'].'/vendor/laravel/lumen-framework/config/', |
|
106 | 106 | // App configuration |
107 | - $this->conf['root_path'] . '/config/', |
|
107 | + $this->conf['root_path'].'/config/', |
|
108 | 108 | ]; |
109 | 109 | |
110 | 110 | $keys = []; |
111 | 111 | foreach ($cfgPaths as $cfgPath) { |
112 | - $configs = (array)glob($cfgPath . '*.php'); |
|
112 | + $configs = (array) glob($cfgPath.'*.php'); |
|
113 | 113 | foreach ($configs as $config) { |
114 | 114 | $config = substr(basename($config), 0, -4); |
115 | 115 | $keys[$config] = $config; |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | |
124 | 124 | public static function autoload($rootPath) |
125 | 125 | { |
126 | - $autoload = $rootPath . '/bootstrap/autoload.php'; |
|
126 | + $autoload = $rootPath.'/bootstrap/autoload.php'; |
|
127 | 127 | if (file_exists($autoload)) { |
128 | 128 | require_once $autoload; |
129 | 129 | } else { |
130 | - require_once $rootPath . '/vendor/autoload.php'; |
|
130 | + require_once $rootPath.'/vendor/autoload.php'; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | // prefer content in response, secondly ob |
159 | - if (!($response instanceof StreamedResponse) && (string)$content === '' && ob_get_length() > 0) { |
|
159 | + if (!($response instanceof StreamedResponse) && (string) $content === '' && ob_get_length() > 0) { |
|
160 | 160 | $response->setContent(ob_get_contents()); |
161 | 161 | } |
162 | 162 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $uri = urldecode($uri); |
175 | 175 | |
176 | 176 | $publicPath = $this->conf['static_path']; |
177 | - $requestFile = $publicPath . $uri; |
|
177 | + $requestFile = $publicPath.$uri; |
|
178 | 178 | if (is_file($requestFile)) { |
179 | 179 | return $this->createStaticResponse($requestFile, $request); |
180 | 180 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | |
191 | 191 | protected function lookupIndex($folder) |
192 | 192 | { |
193 | - $folder = rtrim($folder, '/') . '/'; |
|
193 | + $folder = rtrim($folder, '/').'/'; |
|
194 | 194 | foreach (['index.html', 'index.htm'] as $index) { |
195 | - $tmpFile = $folder . $index; |
|
195 | + $tmpFile = $folder.$index; |
|
196 | 196 | if (is_file($tmpFile)) { |
197 | 197 | return $tmpFile; |
198 | 198 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | public function bindSwoole($swoole) |
235 | 235 | { |
236 | - $this->currentApp->singleton('swoole', function () use ($swoole) { |
|
236 | + $this->currentApp->singleton('swoole', function() use ($swoole) { |
|
237 | 237 | return $swoole; |
238 | 238 | }); |
239 | 239 | } |