Passed
Pull Request — master (#161)
by
unknown
02:39
created
src/Server/Resetters/RebindViewContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     {
19 19
         $view = $app->make('view');
20 20
 
21
-        $closure = function () use ($app) {
21
+        $closure = function() use ($app) {
22 22
             $this->container = $app;
23 23
             $this->shared['app'] = $app;
24 24
         };
Please login to merge, or discard this patch.
src/Server/helpers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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;
@@ -13,6 +13,6 @@  discard block
 block discarded – undo
13 13
 /**
14 14
  * This is only for `function not exists` in config/swoole_http.php.
15 15
  */
16
-if (! defined('SWOOLE_SOCK_TCP')) {
16
+if (!defined('SWOOLE_SOCK_TCP')) {
17 17
     define('SWOOLE_SOCK_TCP', 1);
18 18
 }
Please login to merge, or discard this patch.
src/Server/Sandbox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct($app = null, $framework = null)
36 36
     {
37
-        if (! $app instanceof Container) {
37
+        if (!$app instanceof Container) {
38 38
             return;
39 39
         }
40 40
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function initialize()
104 104
     {
105
-        if (! $this->app instanceof Container) {
105
+        if (!$this->app instanceof Container) {
106 106
             throw new SandboxException('A base app has not been set.');
107 107
         }
108 108
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function run(Request $request)
151 151
     {
152
-        if (! $this->getSnapshot() instanceof Container) {
152
+        if (!$this->getSnapshot() instanceof Container) {
153 153
             throw new SandboxException('Sandbox is not enabled.');
154 154
         }
155 155
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             $response->sendContent();
200 200
         } elseif ($response instanceof SymfonyResponse) {
201 201
             $content = $response->getContent();
202
-        } elseif (! $isFile = $response instanceof BinaryFileResponse) {
202
+        } elseif (!$isFile = $response instanceof BinaryFileResponse) {
203 203
             $content = (string) $response;
204 204
         }
205 205
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $this->terminate($request, $response);
208 208
 
209 209
         // append ob content to response
210
-        if (! $isFile && ob_get_length() > 0) {
210
+        if (!$isFile && ob_get_length() > 0) {
211 211
             if ($isStream) {
212 212
                 $response->output = ob_get_contents();
213 213
             } else {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      */
281 281
     public function enable()
282 282
     {
283
-        if (! $this->config instanceof ConfigContract) {
283
+        if (!$this->config instanceof ConfigContract) {
284 284
             throw new SandboxException('Please initialize after setting base app.');
285 285
         }
286 286
 
Please login to merge, or discard this patch.
src/Commands/HttpServerCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $pid = $this->getPid();
108 108
 
109
-        if (! $this->isRunning($pid)) {
109
+        if (!$this->isRunning($pid)) {
110 110
             $this->error("Failed! There is no swoole_http_server process running.");
111 111
             exit(1);
112 112
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $pid = $this->getPid();
150 150
 
151
-        if (! $this->isRunning($pid)) {
151
+        if (!$this->isRunning($pid)) {
152 152
             $this->error("Failed! There is no swoole_http_server process running.");
153 153
             exit(1);
154 154
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         $isRunning = $this->killProcess($pid, SIGUSR1);
159 159
 
160
-        if (! $isRunning) {
160
+        if (!$isRunning) {
161 161
             $this->error('> failure');
162 162
             exit(1);
163 163
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $this->action = $this->argument('action');
217 217
 
218
-        if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) {
218
+        if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) {
219 219
             $this->error("Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'.");
220 220
             exit(1);
221 221
         }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     protected function isRunning($pid)
231 231
     {
232
-        if (! $pid) {
232
+        if (!$pid) {
233 233
             return false;
234 234
         }
235 235
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             $start = time();
257 257
 
258 258
             do {
259
-                if (! $this->isRunning($pid)) {
259
+                if (!$this->isRunning($pid)) {
260 260
                     break;
261 261
                 }
262 262
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         if (file_exists($path)) {
285 285
             $pid = (int) file_get_contents($path);
286 286
 
287
-            if (! $pid) {
287
+            if (!$pid) {
288 288
                 $this->removePidFile();
289 289
             } else {
290 290
                 $this->pid = $pid;
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
         if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
331 331
             $this->error("Swoole extension doesn't support Windows OS yet.");
332 332
             exit;
333
-        } elseif (! extension_loaded('swoole')) {
333
+        } elseif (!extension_loaded('swoole')) {
334 334
             $this->error("Can't detect Swoole extension installed.");
335 335
             exit;
336
-        } elseif (! version_compare(swoole_version(), '4.0.0', 'ge')) {
336
+        } elseif (!version_compare(swoole_version(), '4.0.0', 'ge')) {
337 337
             $this->error("Your Swoole version must be higher than 4.0 to use coroutine.");
338 338
             exit;
339 339
         }
Please login to merge, or discard this patch.
src/Websocket/Rooms/TableRoom.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Websocket/Rooms/RedisRoom.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Concerns/ResetApplication.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $providers = $this->config->get('swoole_http.providers', []);
49 49
 
50 50
         foreach ($providers as $provider) {
51
-            if (class_exists($provider) && ! in_array($provider, $this->providers)) {
51
+            if (class_exists($provider) && !in_array($provider, $this->providers)) {
52 52
                 $providerClass = new $provider($app);
53 53
                 $this->providers[$provider] = $providerClass;
54 54
             }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         foreach ($resetters as $resetter) {
75 75
             $resetterClass = $app->make($resetter);
76
-            if (! $resetterClass instanceof ResetterContract) {
76
+            if (!$resetterClass instanceof ResetterContract) {
77 77
                 throw new SandboxException("{$resetter} must implement " . ResetterContract::class);
78 78
             }
79 79
             $this->resetters[$resetter] = $resetterClass;
Please login to merge, or discard this patch.
src/Server/Manager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             if (method_exists($this, $listener)) {
104 104
                 $this->container['swoole.server']->on($event, [$this, $listener]);
105 105
             } else {
106
-                $this->container['swoole.server']->on($event, function () use ($event) {
106
+                $this->container['swoole.server']->on($event, function() use ($event) {
107 107
                     $event = sprintf('swoole.%s', $event);
108 108
 
109 109
                     $this->container['events']->fire($event, func_get_args());
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         // don't init laravel app in task workers
147 147
         if ($server->taskworker) {
148
-            $this->setProcessName('task process');//mark task process
148
+            $this->setProcessName('task process'); //mark task process
149 149
             return;
150 150
         }
151 151
         $this->setProcessName('worker process');
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     (new SwooleTaskJob($this->container, $server, $data, $taskId, $srcWorkerId))->fire();
246 246
                 }
247 247
             }
248
-            $server->finish("$taskId finished");//if not ,don't call onFinish
248
+            $server->finish("$taskId finished"); //if not ,don't call onFinish
249 249
         } catch (Throwable $e) {
250 250
             $this->logServerError($e);
251 251
         }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     protected function bindSandbox()
290 290
     {
291
-        $this->app->singleton(Sandbox::class, function ($app) {
291
+        $this->app->singleton(Sandbox::class, function($app) {
292 292
             return new Sandbox($app, $this->framework);
293 293
         });
294 294
         $this->app->alias(Sandbox::class, 'swoole.sandbox');
Please login to merge, or discard this patch.
src/HttpServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $options = $config->get('swoole_http.server.options');
131 131
 
132 132
         // only enable task worker in websocket mode and for queue driver
133
-        if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) {
133
+        if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) {
134 134
             unset($config['task_worker_num']);
135 135
         }
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function registerServer()
146 146
     {
147
-        $this->app->singleton(Server::class, function () {
147
+        $this->app->singleton(Server::class, function() {
148 148
             if (is_null(static::$server)) {
149 149
                 $this->createSwooleServer();
150 150
                 $this->configureSwooleServer();
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function registerDatabaseDriver()
165 165
     {
166
-        $this->app->extend('db', function ($db) {
167
-            $db->extend('mysql-coroutine', function ($config, $name) {
166
+        $this->app->extend('db', function($db) {
167
+            $db->extend('mysql-coroutine', function($config, $name) {
168 168
                 $config['name'] = $name;
169 169
 
170 170
                 if (isset($config['read'])) {
171 171
                     $config = array_merge($config, $config['read']);
172 172
                 }
173 173
 
174
-                $connectionRead = function () use ($config) {
174
+                $connectionRead = function() use ($config) {
175 175
                     return (new MySqlConnector())->connect($config);
176 176
                 };
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                     $config = array_merge($config, $config['write']);
180 180
                 }
181 181
 
182
-                $connection = function () use ($config) {
182
+                $connection = function() use ($config) {
183 183
                     return (new MySqlConnector())->connect($config);
184 184
                 };
185 185
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
      */
201 201
     protected function registerSwooleQueueDriver()
202 202
     {
203
-        $this->app->afterResolving('queue', function ($manager) {
204
-            $manager->addConnector('swoole', function () {
203
+        $this->app->afterResolving('queue', function($manager) {
204
+            $manager->addConnector('swoole', function() {
205 205
                 return new SwooleTaskConnector($this->app->make(Server::class));
206 206
             });
207 207
         });
Please login to merge, or discard this patch.