@@ -3,7 +3,7 @@ |
||
3 | 3 | /** |
4 | 4 | * This is only for `function not exists` in config/swoole_http.php. |
5 | 5 | */ |
6 | -if (! function_exists('swoole_cpu_num')) { |
|
6 | +if (!function_exists('swoole_cpu_num')) { |
|
7 | 7 | function swoole_cpu_num() |
8 | 8 | { |
9 | 9 | return; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public function upgrade(Request $request) |
12 | 12 | { |
13 | - if (! in_array($request->input('transport'), $this->transports)) { |
|
13 | + if (!in_array($request->input('transport'), $this->transports)) { |
|
14 | 14 | return response()->json([ |
15 | 15 | 'code' => 0, |
16 | 16 | 'message' => 'Transport unknown' |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->checkTable($table); |
92 | 92 | $redisKey = $this->getKey($key, $table); |
93 | 93 | |
94 | - $this->redis->pipeline(function ($pipe) use ($redisKey, $values) { |
|
94 | + $this->redis->pipeline(function($pipe) use ($redisKey, $values) { |
|
95 | 95 | foreach ($values as $value) { |
96 | 96 | $pipe->sadd($redisKey, $value); |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $this->checkTable($table); |
106 | 106 | $redisKey = $this->getKey($key, $table); |
107 | 107 | |
108 | - $this->redis->pipeline(function ($pipe) use ($redisKey, $values) { |
|
108 | + $this->redis->pipeline(function($pipe) use ($redisKey, $values) { |
|
109 | 109 | foreach ($values as $value) { |
110 | 110 | $pipe->srem($redisKey, $value); |
111 | 111 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function checkTable(string $table) |
128 | 128 | { |
129 | - if (! in_array($table, ['rooms', 'fds'])) { |
|
129 | + if (!in_array($table, ['rooms', 'fds'])) { |
|
130 | 130 | throw new \InvalidArgumentException('invalid table name.'); |
131 | 131 | } |
132 | 132 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | foreach ($rooms as $room) { |
56 | 56 | $fds = $this->getClients($room); |
57 | 57 | |
58 | - if (! in_array($fd, $fds)) { |
|
58 | + if (!in_array($fd, $fds)) { |
|
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | protected function checkTable(string $table) |
124 | 124 | { |
125 | - if (! property_exists($this, $table) || ! $this->$table instanceof Table) { |
|
125 | + if (!property_exists($this, $table) || !$this->$table instanceof Table) { |
|
126 | 126 | throw new \InvalidArgumentException('invalid table name.'); |
127 | 127 | } |
128 | 128 | } |
@@ -107,7 +107,7 @@ |
||
107 | 107 | { |
108 | 108 | $type = $packet[0] ?? null; |
109 | 109 | |
110 | - if (! array_key_exists($type, static::$socketTypes)) { |
|
110 | + if (!array_key_exists($type, static::$socketTypes)) { |
|
111 | 111 | return null; |
112 | 112 | } |
113 | 113 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function onOpen($fd, Request $request) |
20 | 20 | { |
21 | - if (! $request->input('sid')) { |
|
21 | + if (!$request->input('sid')) { |
|
22 | 22 | $payload = json_encode([ |
23 | 23 | 'sid' => base64_encode(uniqid()), |
24 | 24 | 'upgrades' => [], |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $users = is_object($users) ? func_get_args() : $users; |
46 | 46 | |
47 | - $userIds = array_map(function ($user) { |
|
47 | + $userIds = array_map(function($user) { |
|
48 | 48 | $this->checkUser($user); |
49 | 49 | return $user->getAuthIdentifier(); |
50 | 50 | }, $users); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getUserId() |
74 | 74 | { |
75 | - if (! is_null($this->userId)) { |
|
75 | + if (!is_null($this->userId)) { |
|
76 | 76 | return $this->userId; |
77 | 77 | } |
78 | 78 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function isUserIdOnline($userId) |
94 | 94 | { |
95 | - return ! empty($this->room->getClients(static::USER_PREFIX . $userId)); |
|
95 | + return !empty($this->room->getClients(static::USER_PREFIX . $userId)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function checkUser($user) |
102 | 102 | { |
103 | - if (! $user instanceOf AuthenticatableContract) { |
|
103 | + if (!$user instanceOf AuthenticatableContract) { |
|
104 | 104 | throw new InvalidArgumentException('user object must implement ' . AuthenticatableContract::class); |
105 | 105 | } |
106 | 106 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function startSession(Request $request) |
55 | 55 | { |
56 | - return tap($this->getSession($request), function ($session) use ($request) { |
|
56 | + return tap($this->getSession($request), function($session) use ($request) { |
|
57 | 57 | $session->setRequestOnHandler($request); |
58 | 58 | |
59 | 59 | $session->start(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function getSession(Request $request) |
70 | 70 | { |
71 | - return tap($this->manager->driver(), function ($session) use ($request) { |
|
71 | + return tap($this->manager->driver(), function($session) use ($request) { |
|
72 | 72 | $session->setId($request->cookies->get($session->getName())); |
73 | 73 | }); |
74 | 74 | } |
@@ -80,6 +80,6 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function sessionConfigured() |
82 | 82 | { |
83 | - return ! is_null($this->manager->getSessionConfig()['driver'] ?? null); |
|
83 | + return !is_null($this->manager->getSessionConfig()['driver'] ?? null); |
|
84 | 84 | } |
85 | 85 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | { |
40 | 40 | try { |
41 | 41 | if ($user = $this->auth->authenticate()) { |
42 | - $request->setUserResolver(function () use ($user) { |
|
42 | + $request->setUserResolver(function() use ($user) { |
|
43 | 43 | return $user; |
44 | 44 | }); |
45 | 45 | } |