@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function pushRaw($payload, $queue = null, array $options = []) |
| 56 | 56 | { |
| 57 | - return $this->swoole->task($payload, ! is_numeric($queue) ? -1 : (int)$queue); |
|
| 57 | + return $this->swoole->task($payload, !is_numeric($queue) ? -1 : (int) $queue); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function later($delay, $job, $data = '', $queue = null) |
| 71 | 71 | { |
| 72 | - return Timer::after($this->secondsUntil($delay) * 1000, function () use ($job, $data, $queue) { |
|
| 72 | + return Timer::after($this->secondsUntil($delay) * 1000, function() use ($job, $data, $queue) { |
|
| 73 | 73 | return $this->push($job, $data, $queue); |
| 74 | 74 | }); |
| 75 | 75 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public static function make($server, string $version): SwooleTaskQueue |
| 42 | 42 | { |
| 43 | 43 | $isMatch = static::isFileVersionMatch($version); |
| 44 | - $class = static::copy(static::stub($version), ! $isMatch); |
|
| 44 | + $class = static::copy(static::stub($version), !$isMatch); |
|
| 45 | 45 | |
| 46 | 46 | return new $class($server); |
| 47 | 47 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public static function copy(string $stub, bool $rewrite = false): string |
| 68 | 68 | { |
| 69 | - if (! file_exists(static::QUEUE_CLASS_PATH) || $rewrite) { |
|
| 69 | + if (!file_exists(static::QUEUE_CLASS_PATH) || $rewrite) { |
|
| 70 | 70 | copy($stub, static::QUEUE_CLASS_PATH); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function upgrade(Request $request) |
| 13 | 13 | { |
| 14 | - if (! in_array($request->input('transport'), $this->transports)) { |
|
| 14 | + if (!in_array($request->input('transport'), $this->transports)) { |
|
| 15 | 15 | return response()->json( |
| 16 | 16 | [ |
| 17 | 17 | 'code' => 0, |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $key = str_replace('-', '_', $key); |
| 159 | 159 | $key = strtoupper($key); |
| 160 | 160 | |
| 161 | - if (! in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
| 161 | + if (!in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
| 162 | 162 | $key = 'HTTP_' . $key; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if (! is_file($fileName) || ! filesize($fileName)) { |
|
| 190 | + if (!is_file($fileName) || !filesize($fileName)) { |
|
| 191 | 191 | return false; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function onOpen($fd, Request $request) |
| 23 | 23 | { |
| 24 | - if (! $request->input('sid')) { |
|
| 24 | + if (!$request->input('sid')) { |
|
| 25 | 25 | $payload = json_encode( |
| 26 | 26 | [ |
| 27 | 27 | 'sid' => base64_encode(uniqid()), |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $values = is_string($values) || is_integer($values) ? func_get_args() : $values; |
| 113 | 113 | |
| 114 | 114 | foreach ($values as $value) { |
| 115 | - if (! in_array($value, $this->to)) { |
|
| 115 | + if (!in_array($value, $this->to)) { |
|
| 116 | 116 | $this->to[] = $value; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | public function emit(string $event, $data): bool |
| 164 | 164 | { |
| 165 | 165 | $fds = $this->getFds(); |
| 166 | - $assigned = ! empty($this->to); |
|
| 166 | + $assigned = !empty($this->to); |
|
| 167 | 167 | |
| 168 | 168 | // if no fds are found, but rooms are assigned |
| 169 | 169 | // that means trying to emit to a non-existing room |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function on(string $event, $callback) |
| 215 | 215 | { |
| 216 | - if (! is_string($callback) && ! is_callable($callback)) { |
|
| 216 | + if (!is_string($callback) && !is_callable($callback)) { |
|
| 217 | 217 | throw new InvalidArgumentException( |
| 218 | 218 | 'Invalid websocket callback. Must be a string or callable.' |
| 219 | 219 | ); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function call(string $event, $data = null) |
| 248 | 248 | { |
| 249 | - if (! $this->eventExists($event)) { |
|
| 249 | + if (!$this->eventExists($event)) { |
|
| 250 | 250 | return null; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | protected function getFds() |
| 322 | 322 | { |
| 323 | - $fds = array_filter($this->to, function ($value) { |
|
| 323 | + $fds = array_filter($this->to, function($value) { |
|
| 324 | 324 | return is_integer($value); |
| 325 | 325 | }); |
| 326 | 326 | $rooms = array_diff($this->to, $fds); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | { |
| 400 | 400 | $pipeline = $this->pipeline; |
| 401 | 401 | |
| 402 | - $closure = function () use ($container) { |
|
| 402 | + $closure = function() use ($container) { |
|
| 403 | 403 | $this->container = $container; |
| 404 | 404 | }; |
| 405 | 405 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | return $this->pipeline |
| 444 | 444 | ->send($request) |
| 445 | 445 | ->through($this->middleware) |
| 446 | - ->then(function ($request) { |
|
| 446 | + ->then(function($request) { |
|
| 447 | 447 | return $request; |
| 448 | 448 | }); |
| 449 | 449 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $users = is_object($users) ? func_get_args() : $users; |
| 65 | 65 | |
| 66 | - $userIds = array_map(function (AuthenticatableContract $user) { |
|
| 66 | + $userIds = array_map(function(AuthenticatableContract $user) { |
|
| 67 | 67 | $this->checkUser($user); |
| 68 | 68 | |
| 69 | 69 | return $user->getAuthIdentifier(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function getUserId() |
| 98 | 98 | { |
| 99 | - if (! is_null($this->userId)) { |
|
| 99 | + if (!is_null($this->userId)) { |
|
| 100 | 100 | return $this->userId; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function isUserIdOnline($userId) |
| 122 | 122 | { |
| 123 | - return ! empty($this->room->getClients(static::USER_PREFIX . $userId)); |
|
| 123 | + return !empty($this->room->getClients(static::USER_PREFIX . $userId)); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | protected function checkUser($user) |
| 132 | 132 | { |
| 133 | - if (! $user instanceOf AuthenticatableContract) { |
|
| 133 | + if (!$user instanceOf AuthenticatableContract) { |
|
| 134 | 134 | throw new InvalidArgumentException('user object must implement ' . AuthenticatableContract::class); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function getApplication() |
| 59 | 59 | { |
| 60 | - if (! $this->app instanceof Container) { |
|
| 60 | + if (!$this->app instanceof Container) { |
|
| 61 | 61 | $this->app = $this->loadApplication(); |
| 62 | 62 | $this->bootstrap(); |
| 63 | 63 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $framework = strtolower($framework); |
| 110 | 110 | |
| 111 | - if (! in_array($framework, ['laravel', 'lumen'])) { |
|
| 111 | + if (!in_array($framework, ['laravel', 'lumen'])) { |
|
| 112 | 112 | throw new FrameworkNotSupportException($framework); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -56,8 +56,8 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | protected function bindSwooleTable() |
| 58 | 58 | { |
| 59 | - if (! $this->app instanceof ConsoleApp) { |
|
| 60 | - $this->app->singleton(SwooleTable::class, function () { |
|
| 59 | + if (!$this->app instanceof ConsoleApp) { |
|
| 60 | + $this->app->singleton(SwooleTable::class, function() { |
|
| 61 | 61 | return $this->currentTable; |
| 62 | 62 | }); |
| 63 | 63 | |