@@ -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 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $laravelSVersion, |
| 110 | 110 | ], |
| 111 | 111 | [ |
| 112 | - $this->getApplication()->getName() . ' [<info>' . env('APP_ENV', config('app.env')) . '</info>]', |
|
| 112 | + $this->getApplication()->getName().' [<info>'.env('APP_ENV', config('app.env')).'</info>]', |
|
| 113 | 113 | $this->getApplication()->getVersion(), |
| 114 | 114 | ], |
| 115 | 115 | ]); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $this->comment('>>> Protocols'); |
| 121 | 121 | |
| 122 | - $config = unserialize((string)file_get_contents($this->getConfPath())); |
|
| 122 | + $config = unserialize((string) file_get_contents($this->getConfPath())); |
|
| 123 | 123 | $socketType = isset($config['server']['socket_type']) ? $config['server']['socket_type'] : SWOOLE_SOCK_TCP; |
| 124 | 124 | if (in_array($socketType, [SWOOLE_SOCK_UNIX_DGRAM, SWOOLE_SOCK_UNIX_STREAM])) { |
| 125 | 125 | $listenAt = $config['server']['listen_ip']; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | continue; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $name = 'Port#' . $key . ' '; |
|
| 161 | + $name = 'Port#'.$key.' '; |
|
| 162 | 162 | $name .= isset($socketTypeNames[$socket['type']]) ? $socketTypeNames[$socket['type']] : 'Unknown socket'; |
| 163 | 163 | $tableRows [] = [ |
| 164 | 164 | $name, |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | $laravelConf = [ |
| 187 | 187 | 'root_path' => $svrConf['laravel_base_path'], |
| 188 | 188 | 'static_path' => $svrConf['swoole']['document_root'], |
| 189 | - 'cleaners' => array_unique((array)Arr::get($svrConf, 'cleaners', [])), |
|
| 190 | - 'register_providers' => array_unique((array)Arr::get($svrConf, 'register_providers', [])), |
|
| 189 | + 'cleaners' => array_unique((array) Arr::get($svrConf, 'cleaners', [])), |
|
| 190 | + 'register_providers' => array_unique((array) Arr::get($svrConf, 'register_providers', [])), |
|
| 191 | 191 | 'destroy_controllers' => Arr::get($svrConf, 'destroy_controllers', []), |
| 192 | 192 | 'is_lumen' => $this->isLumen(), |
| 193 | 193 | '_SERVER' => $_SERVER, |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $svrConf['ignore_check_pid'] = false; |
| 221 | 221 | } |
| 222 | 222 | if (empty($svrConf['swoole']['document_root'])) { |
| 223 | - $svrConf['swoole']['document_root'] = $svrConf['laravel_base_path'] . '/public'; |
|
| 223 | + $svrConf['swoole']['document_root'] = $svrConf['laravel_base_path'].'/public'; |
|
| 224 | 224 | } |
| 225 | 225 | if ($this->option('daemonize')) { |
| 226 | 226 | $svrConf['swoole']['daemonize'] = true; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Set X-Version |
| 238 | - $xVersion = (string)$this->option('x-version'); |
|
| 238 | + $xVersion = (string) $this->option('x-version'); |
|
| 239 | 239 | if ($xVersion !== '') { |
| 240 | 240 | $_SERVER['X_VERSION'] = $_ENV['X_VERSION'] = $xVersion; |
| 241 | 241 | } |
@@ -262,34 +262,34 @@ discard block |
||
| 262 | 262 | public function publish() |
| 263 | 263 | { |
| 264 | 264 | $basePath = config('laravels.laravel_base_path') ?: base_path(); |
| 265 | - $configPath = $basePath . '/config/laravels.php'; |
|
| 265 | + $configPath = $basePath.'/config/laravels.php'; |
|
| 266 | 266 | $todoList = [ |
| 267 | 267 | [ |
| 268 | - 'from' => realpath(__DIR__ . '/../../config/laravels.php'), |
|
| 268 | + 'from' => realpath(__DIR__.'/../../config/laravels.php'), |
|
| 269 | 269 | 'to' => $configPath, |
| 270 | 270 | 'mode' => 0644, |
| 271 | 271 | ], |
| 272 | 272 | [ |
| 273 | - 'from' => realpath(__DIR__ . '/../../bin/laravels'), |
|
| 274 | - 'to' => $basePath . '/bin/laravels', |
|
| 273 | + 'from' => realpath(__DIR__.'/../../bin/laravels'), |
|
| 274 | + 'to' => $basePath.'/bin/laravels', |
|
| 275 | 275 | 'mode' => 0755, |
| 276 | 276 | 'link' => true, |
| 277 | 277 | ], |
| 278 | 278 | [ |
| 279 | - 'from' => realpath(__DIR__ . '/../../bin/fswatch'), |
|
| 280 | - 'to' => $basePath . '/bin/fswatch', |
|
| 279 | + 'from' => realpath(__DIR__.'/../../bin/fswatch'), |
|
| 280 | + 'to' => $basePath.'/bin/fswatch', |
|
| 281 | 281 | 'mode' => 0755, |
| 282 | 282 | 'link' => true, |
| 283 | 283 | ], |
| 284 | 284 | [ |
| 285 | - 'from' => realpath(__DIR__ . '/../../bin/inotify'), |
|
| 286 | - 'to' => $basePath . '/bin/inotify', |
|
| 285 | + 'from' => realpath(__DIR__.'/../../bin/inotify'), |
|
| 286 | + 'to' => $basePath.'/bin/inotify', |
|
| 287 | 287 | 'mode' => 0755, |
| 288 | 288 | 'link' => true, |
| 289 | 289 | ], |
| 290 | 290 | ]; |
| 291 | 291 | if (file_exists($configPath)) { |
| 292 | - $choice = $this->anticipate($configPath . ' already exists, do you want to override it ? Y/N', |
|
| 292 | + $choice = $this->anticipate($configPath.' already exists, do you want to override it ? Y/N', |
|
| 293 | 293 | ['Y', 'N'], |
| 294 | 294 | 'N' |
| 295 | 295 | ); |
@@ -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; |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | $basePath = dirname($pidFile); |
| 189 | 189 | $deleteFiles = [ |
| 190 | 190 | $pidFile, |
| 191 | - $basePath . '/laravels-custom-processes.pid', |
|
| 192 | - $basePath . '/laravels-timer-process.pid', |
|
| 191 | + $basePath.'/laravels-custom-processes.pid', |
|
| 192 | + $basePath.'/laravels-timer-process.pid', |
|
| 193 | 193 | ]; |
| 194 | 194 | foreach ($deleteFiles as $deleteFile) { |
| 195 | 195 | if (file_exists($deleteFile)) { |
@@ -239,9 +239,9 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // Reload custom processes |
| 242 | - $pidFile = dirname($pidFile) . '/laravels-custom-processes.pid'; |
|
| 242 | + $pidFile = dirname($pidFile).'/laravels-custom-processes.pid'; |
|
| 243 | 243 | if (file_exists($pidFile)) { |
| 244 | - $pids = (array)explode("\n", trim(file_get_contents($pidFile))); |
|
| 244 | + $pids = (array) explode("\n", trim(file_get_contents($pidFile))); |
|
| 245 | 245 | unlink($pidFile); |
| 246 | 246 | foreach ($pids as $pid) { |
| 247 | 247 | if (!$pid || !self::kill($pid, 0)) { |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | // Reload timer process |
| 261 | 261 | if (!empty($config['server']['timer']['enable']) && !empty($config['server']['timer']['jobs'])) { |
| 262 | - $pidFile = dirname($pidFile) . '/laravels-timer-process.pid'; |
|
| 262 | + $pidFile = dirname($pidFile).'/laravels-timer-process.pid'; |
|
| 263 | 263 | $pid = file_get_contents($pidFile); |
| 264 | 264 | if (!$pid || !self::kill($pid, 0)) { |
| 265 | 265 | $this->error("Timer process[PID={$pid}] does not exist, or permission denied."); |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | public function loadApollo(array $options) |
| 284 | 284 | { |
| 285 | 285 | Client::putCommandOptionsToEnv($options); |
| 286 | - $envFile = $this->basePath . '/.env'; |
|
| 286 | + $envFile = $this->basePath.'/.env'; |
|
| 287 | 287 | if (isset($options['env'])) { |
| 288 | - $envFile .= '.' . $options['env']; |
|
| 288 | + $envFile .= '.'.$options['env']; |
|
| 289 | 289 | } |
| 290 | 290 | Client::createFromCommandOptions($options)->pullAllAndSave($envFile); |
| 291 | 291 | } |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | public function getConfig() |
| 308 | 308 | { |
| 309 | - return unserialize((string)file_get_contents($this->getConfPath())); |
|
| 309 | + return unserialize((string) file_get_contents($this->getConfPath())); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | protected function getConfPath() |
| 313 | 313 | { |
| 314 | - return $this->basePath . '/storage/laravels.conf'; |
|
| 314 | + return $this->basePath.'/storage/laravels.conf'; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | public static function runCommand($cmd, $input = null) |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | public static function kill($pid, $sig) |
| 333 | 333 | { |
| 334 | 334 | try { |
| 335 | - return Process::kill((int)$pid, $sig); |
|
| 335 | + return Process::kill((int) $pid, $sig); |
|
| 336 | 336 | } catch (\Exception $e) { |
| 337 | 337 | return false; |
| 338 | 338 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function interval() |
| 13 | 13 | { |
| 14 | - return (int)(static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 14 | + return (int) (static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function isImmediate() |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function interval() |
| 13 | 13 | { |
| 14 | - return (int)(static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 14 | + return (int) (static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function isImmediate() |