@@ -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 = self::runArtisanCommand($this->basePath, trim('laravels config ' . $passOptionStr)); |
|
| 136 | + $statusCode = self::runArtisanCommand($this->basePath, 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 | } |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | $phpCmd = sprintf('%s -c "%s"', PHP_BINARY, $iniFile); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $checkSwooleCmd = $phpCmd . ' --ri swoole'; |
|
| 315 | - $checkOutput = (string)shell_exec($checkSwooleCmd); |
|
| 314 | + $checkSwooleCmd = $phpCmd.' --ri swoole'; |
|
| 315 | + $checkOutput = (string) shell_exec($checkSwooleCmd); |
|
| 316 | 316 | if (stripos($checkOutput, 'enabled') === false) { |
| 317 | 317 | $phpCmd .= ' -d "extension=swoole"'; |
| 318 | 318 | } |
| 319 | - return trim($phpCmd . ' ' . $subCmd); |
|
| 319 | + return trim($phpCmd.' '.$subCmd); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | public static function runArtisanCommand($basePath, $cmd) |
@@ -333,12 +333,12 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | public function getConfig() |
| 335 | 335 | { |
| 336 | - return unserialize((string)file_get_contents($this->getConfPath())); |
|
| 336 | + return unserialize((string) file_get_contents($this->getConfPath())); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | protected function getConfPath() |
| 340 | 340 | { |
| 341 | - return $this->basePath . '/storage/laravels.conf'; |
|
| 341 | + return $this->basePath.'/storage/laravels.conf'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | public static function runCommand($cmd, $input = null) |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | public static function kill($pid, $sig) |
| 360 | 360 | { |
| 361 | 361 | try { |
| 362 | - return Process::kill((int)$pid, $sig); |
|
| 362 | + return Process::kill((int) $pid, $sig); |
|
| 363 | 363 | } catch (\Exception $e) { |
| 364 | 364 | return false; |
| 365 | 365 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function handle() |
| 23 | 23 | { |
| 24 | - $action = (string)$this->argument('action'); |
|
| 24 | + $action = (string) $this->argument('action'); |
|
| 25 | 25 | switch ($action) { |
| 26 | 26 | case 'publish': |
| 27 | 27 | $this->publish(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | // Load configuration laravel.php manually for Lumen |
| 55 | 55 | $basePath = config('laravels.laravel_base_path') ?: base_path(); |
| 56 | - if ($this->isLumen() && file_exists($basePath . '/config/laravels.php')) { |
|
| 56 | + if ($this->isLumen() && file_exists($basePath.'/config/laravels.php')) { |
|
| 57 | 57 | $this->getLaravel()->configure('laravels'); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $laravelSVersion, |
| 111 | 111 | ], |
| 112 | 112 | [ |
| 113 | - $this->getApplication()->getName() . ' [<info>' . env('APP_ENV', config('app.env')) . '</info>]', |
|
| 113 | + $this->getApplication()->getName().' [<info>'.env('APP_ENV', config('app.env')).'</info>]', |
|
| 114 | 114 | $this->getApplication()->getVersion(), |
| 115 | 115 | ], |
| 116 | 116 | ]); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $this->comment('>>> Protocols'); |
| 122 | 122 | |
| 123 | - $config = unserialize((string)file_get_contents($this->getConfigPath())); |
|
| 123 | + $config = unserialize((string) file_get_contents($this->getConfigPath())); |
|
| 124 | 124 | $ssl = isset($config['server']['swoole']['ssl_key_file'], $config['server']['swoole']['ssl_cert_file']); |
| 125 | 125 | $socketType = isset($config['server']['socket_type']) ? $config['server']['socket_type'] : SWOOLE_SOCK_TCP; |
| 126 | 126 | if (in_array($socketType, [SWOOLE_SOCK_UNIX_DGRAM, SWOOLE_SOCK_UNIX_STREAM])) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | continue; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $name = 'Port#' . $key . ' '; |
|
| 163 | + $name = 'Port#'.$key.' '; |
|
| 164 | 164 | $name .= isset($socketTypeNames[$socket['type']]) ? $socketTypeNames[$socket['type']] : 'Unknown socket'; |
| 165 | 165 | $tableRows [] = [ |
| 166 | 166 | $name, |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | $laravelConf = [ |
| 189 | 189 | 'root_path' => $svrConf['laravel_base_path'], |
| 190 | 190 | 'static_path' => $svrConf['swoole']['document_root'], |
| 191 | - 'cleaners' => array_unique((array)Arr::get($svrConf, 'cleaners', [])), |
|
| 192 | - 'register_providers' => array_unique((array)Arr::get($svrConf, 'register_providers', [])), |
|
| 191 | + 'cleaners' => array_unique((array) Arr::get($svrConf, 'cleaners', [])), |
|
| 192 | + 'register_providers' => array_unique((array) Arr::get($svrConf, 'register_providers', [])), |
|
| 193 | 193 | 'destroy_controllers' => Arr::get($svrConf, 'destroy_controllers', []), |
| 194 | 194 | 'is_lumen' => $this->isLumen(), |
| 195 | 195 | '_SERVER' => $_SERVER, |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $svrConf['ignore_check_pid'] = false; |
| 223 | 223 | } |
| 224 | 224 | if (empty($svrConf['swoole']['document_root'])) { |
| 225 | - $svrConf['swoole']['document_root'] = $svrConf['laravel_base_path'] . '/public'; |
|
| 225 | + $svrConf['swoole']['document_root'] = $svrConf['laravel_base_path'].'/public'; |
|
| 226 | 226 | } |
| 227 | 227 | if ($this->option('daemonize')) { |
| 228 | 228 | $svrConf['swoole']['daemonize'] = true; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | // Set X-Version |
| 240 | - $xVersion = (string)$this->option('x-version'); |
|
| 240 | + $xVersion = (string) $this->option('x-version'); |
|
| 241 | 241 | if ($xVersion !== '') { |
| 242 | 242 | $_SERVER['X_VERSION'] = $_ENV['X_VERSION'] = $xVersion; |
| 243 | 243 | } |
@@ -264,34 +264,34 @@ discard block |
||
| 264 | 264 | public function publish() |
| 265 | 265 | { |
| 266 | 266 | $basePath = config('laravels.laravel_base_path') ?: base_path(); |
| 267 | - $configPath = $basePath . '/config/laravels.php'; |
|
| 267 | + $configPath = $basePath.'/config/laravels.php'; |
|
| 268 | 268 | $todoList = [ |
| 269 | 269 | [ |
| 270 | - 'from' => realpath(__DIR__ . '/../../config/laravels.php'), |
|
| 270 | + 'from' => realpath(__DIR__.'/../../config/laravels.php'), |
|
| 271 | 271 | 'to' => $configPath, |
| 272 | 272 | 'mode' => 0644, |
| 273 | 273 | ], |
| 274 | 274 | [ |
| 275 | - 'from' => realpath(__DIR__ . '/../../bin/laravels'), |
|
| 276 | - 'to' => $basePath . '/bin/laravels', |
|
| 275 | + 'from' => realpath(__DIR__.'/../../bin/laravels'), |
|
| 276 | + 'to' => $basePath.'/bin/laravels', |
|
| 277 | 277 | 'mode' => 0755, |
| 278 | 278 | 'link' => true, |
| 279 | 279 | ], |
| 280 | 280 | [ |
| 281 | - 'from' => realpath(__DIR__ . '/../../bin/fswatch'), |
|
| 282 | - 'to' => $basePath . '/bin/fswatch', |
|
| 281 | + 'from' => realpath(__DIR__.'/../../bin/fswatch'), |
|
| 282 | + 'to' => $basePath.'/bin/fswatch', |
|
| 283 | 283 | 'mode' => 0755, |
| 284 | 284 | 'link' => true, |
| 285 | 285 | ], |
| 286 | 286 | [ |
| 287 | - 'from' => realpath(__DIR__ . '/../../bin/inotify'), |
|
| 288 | - 'to' => $basePath . '/bin/inotify', |
|
| 287 | + 'from' => realpath(__DIR__.'/../../bin/inotify'), |
|
| 288 | + 'to' => $basePath.'/bin/inotify', |
|
| 289 | 289 | 'mode' => 0755, |
| 290 | 290 | 'link' => true, |
| 291 | 291 | ], |
| 292 | 292 | ]; |
| 293 | 293 | if (file_exists($configPath)) { |
| 294 | - $choice = $this->anticipate($configPath . ' already exists, do you want to override it ? Y/N', |
|
| 294 | + $choice = $this->anticipate($configPath.' already exists, do you want to override it ? Y/N', |
|
| 295 | 295 | ['Y', 'N'], |
| 296 | 296 | 'N' |
| 297 | 297 | ); |