Passed
Pull Request — master (#271)
by Bill
02:24
created
src/HttpServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $options = $config->get('swoole_http.server.options');
150 150
 
151 151
         // only enable task worker in websocket mode and for queue driver
152
-        if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) {
152
+        if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) {
153 153
             unset($options['task_worker_num']);
154 154
         }
155 155
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function registerServer()
165 165
     {
166
-        $this->app->singleton(Server::class, function () {
166
+        $this->app->singleton(Server::class, function() {
167 167
             if (is_null(static::$server)) {
168 168
                 $this->createSwooleServer();
169 169
                 $this->configureSwooleServer();
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
      */
180 180
     protected function registerDatabaseDriver()
181 181
     {
182
-        $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) {
183
-            $db->extend('mysql-coroutine', function ($config, $name) {
182
+        $this->app->extend(DatabaseManager::class, function(DatabaseManager $db) {
183
+            $db->extend('mysql-coroutine', function($config, $name) {
184 184
                 $config['name'] = $name;
185 185
 
186 186
                 $connection = new MySqlConnection(
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
      */
224 224
     protected function registerSwooleQueueDriver()
225 225
     {
226
-        $this->app->afterResolving('queue', function (QueueManager $manager) {
227
-            $manager->addConnector('swoole', function () {
226
+        $this->app->afterResolving('queue', function(QueueManager $manager) {
227
+            $manager->addConnector('swoole', function() {
228 228
                 return new SwooleTaskConnector($this->app->make(Server::class));
229 229
             });
230 230
         });
Please login to merge, or discard this patch.
src/Helpers/Dumper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
     public static function dump(...$args)
14 14
     {
15
-        if (! static::$cloner instanceOf VarCloner) {
15
+        if (!static::$cloner instanceOf VarCloner) {
16 16
             static::$cloner = new VarCloner;
17 17
         }
18 18
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public static function getDumper()
31 31
     {
32
-        $dumper = defined('IN_PHPUNIT') || ! config('swoole_http.ob_output')
32
+        $dumper = defined('IN_PHPUNIT') || !config('swoole_http.ob_output')
33 33
             ? CliDumper::class
34 34
             : HtmlDumper::class;
35 35
 
Please login to merge, or discard this patch.
src/Websocket/Pusher.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function shouldBroadcast(): bool
211 211
     {
212
-        return $this->broadcast && empty($this->descriptors) && ! $this->assigned;
212
+        return $this->broadcast && empty($this->descriptors) && !$this->assigned;
213 213
     }
214 214
 
215 215
     /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     protected function getWebsocketConnections(): array
223 223
     {
224
-        return array_filter(iterator_to_array($this->server->connections), function ($fd) {
224
+        return array_filter(iterator_to_array($this->server->connections), function($fd) {
225 225
             return $this->server->isEstablished($fd);
226 226
         });
227 227
     }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function shouldPushToDescriptor(int $fd): bool
235 235
     {
236
-        if (! $this->server->isEstablished($fd)) {
236
+        if (!$this->server->isEstablished($fd)) {
237 237
             return false;
238 238
         }
239 239
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     public function push($payload): void
251 251
     {
252 252
         // attach sender if not broadcast
253
-        if (! $this->broadcast && $this->sender && ! $this->hasDescriptor($this->sender)) {
253
+        if (!$this->broadcast && $this->sender && !$this->hasDescriptor($this->sender)) {
254 254
             $this->addDescriptor($this->sender);
255 255
         }
256 256
 
Please login to merge, or discard this patch.
src/LaravelServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     protected function registerManager()
21 21
     {
22
-        $this->app->singleton(Manager::class, function ($app) {
22
+        $this->app->singleton(Manager::class, function($app) {
23 23
             return new Manager($app, 'laravel', base_path(), $this->app[PidManager::class]);
24 24
         });
25 25
 
Please login to merge, or discard this patch.
src/LumenServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */
19 19
     protected function registerManager()
20 20
     {
21
-        $this->app->singleton(Manager::class, function ($app) {
21
+        $this->app->singleton(Manager::class, function($app) {
22 22
             return new Manager($app, 'lumen', base_path(), $this->app[PidManager::class]);
23 23
         });
24 24
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function bootWebsocketRoutes()
34 34
     {
35 35
         $this->app->router
36
-            ->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($router) {
36
+            ->group(['namespace' => 'SwooleTW\Http\Controllers'], function($router) {
37 37
                 require __DIR__ . '/../routes/lumen_routes.php';
38 38
             });
39 39
     }
Please login to merge, or discard this patch.
src/Commands/HttpServerCommand.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     protected function stop()
154 154
     {
155
-        if (! $this->isRunning()) {
155
+        if (!$this->isRunning()) {
156 156
             $this->error("Failed! There is no swoole_http_server process running.");
157 157
 
158 158
             return;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     protected function reload()
194 194
     {
195
-        if (! $this->isRunning()) {
195
+        if (!$this->isRunning()) {
196 196
             $this->error("Failed! There is no swoole_http_server process running.");
197 197
 
198 198
             return;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
         $this->info('Reloading swoole_http_server...');
202 202
 
203
-        if (! $this->killProcess(SIGUSR1)) {
203
+        if (!$this->killProcess(SIGUSR1)) {
204 204
             $this->error('> failure');
205 205
 
206 206
             return;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $this->action = $this->argument('action');
258 258
 
259
-        if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
259
+        if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
260 260
             $this->error(
261 261
                 "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."
262 262
             );
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         $filter = Arr::get($this->config, 'hot_reload.filter');
278 278
         $log = Arr::get($this->config, 'hot_reload.log');
279 279
 
280
-        $cb = function (FSEvent $event) use ($server, $log) {
280
+        $cb = function(FSEvent $event) use ($server, $log) {
281 281
             $log ? $this->info(FSOutput::format($event)) : null;
282 282
             $server->reload();
283 283
         };
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             $start = time();
331 331
 
332 332
             do {
333
-                if (! $this->isRunning()) {
333
+                if (!$this->isRunning()) {
334 334
                     break;
335 335
                 }
336 336
 
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
             exit(1);
361 361
         }
362 362
 
363
-        if (! extension_loaded('swoole')) {
363
+        if (!extension_loaded('swoole')) {
364 364
             $this->error('Can\'t detect Swoole extension installed.');
365 365
 
366 366
             exit(1);
367 367
         }
368 368
 
369
-        if (! version_compare(swoole_version(), '4.3.1', 'ge')) {
369
+        if (!version_compare(swoole_version(), '4.3.1', 'ge')) {
370 370
             $this->error('Your Swoole version must be higher than `4.3.1`.');
371 371
 
372 372
             exit(1);
@@ -378,15 +378,15 @@  discard block
 block discarded – undo
378 378
      */
379 379
     protected function registerAccessLog()
380 380
     {
381
-        $this->laravel->singleton(OutputStyle::class, function () {
381
+        $this->laravel->singleton(OutputStyle::class, function() {
382 382
             return new OutputStyle($this->input, $this->output);
383 383
         });
384 384
 
385
-        $this->laravel->singleton(AccessOutput::class, function () {
385
+        $this->laravel->singleton(AccessOutput::class, function() {
386 386
             return new AccessOutput(new ConsoleOutput);
387 387
         });
388 388
 
389
-        $this->laravel->singleton(AccessLog::class, function (Container $container) {
389
+        $this->laravel->singleton(AccessLog::class, function(Container $container) {
390 390
             return new AccessLog($container->make(AccessOutput::class));
391 391
         });
392 392
     }
Please login to merge, or discard this patch.
src/Server/PidManager.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -4,69 +4,69 @@
 block discarded – undo
4 4
 
5 5
 class PidManager
6 6
 {
7
-	/**
8
-	 * @var string
9
-	 */
10
-	private $pidFile = '';
7
+    /**
8
+     * @var string
9
+     */
10
+    private $pidFile = '';
11 11
 
12
-	public function __construct(string $pidFile)
13
-	{
14
-		$this->pidFile = $pidFile;
15
-	}
12
+    public function __construct(string $pidFile)
13
+    {
14
+        $this->pidFile = $pidFile;
15
+    }
16 16
 
17
-	/**
18
-	 * Write master pid and manager pid to pid file
19
-	 *
20
-	 * @throws \RuntimeException When $pidFile is not writable
21
-	 */
22
-	public function write(int $masterPid, int $managerPid): void
23
-	{
24
-		if (! is_writable($this->pidFile) && ! is_writable(dirname($this->pidFile))) {
25
-			throw new \RuntimeException(sprintf('Pid file "%s" is not writable', $this->pidFile));
26
-		}
17
+    /**
18
+     * Write master pid and manager pid to pid file
19
+     *
20
+     * @throws \RuntimeException When $pidFile is not writable
21
+     */
22
+    public function write(int $masterPid, int $managerPid): void
23
+    {
24
+        if (! is_writable($this->pidFile) && ! is_writable(dirname($this->pidFile))) {
25
+            throw new \RuntimeException(sprintf('Pid file "%s" is not writable', $this->pidFile));
26
+        }
27 27
 
28
-		file_put_contents($this->pidFile, $masterPid . ',' . $managerPid);
29
-	}
28
+        file_put_contents($this->pidFile, $masterPid . ',' . $managerPid);
29
+    }
30 30
 
31
-	/**
32
-	 * Read master pid and manager pid from pid file
33
-	 *
34
-	 * @return string[] {
35
-	 *	 @var string $masterPid
36
-	 *	 @var string $managerPid
37
-	 * }
38
-	 */
39
-	public function read(): array
40
-	{
41
-		$pids = [];
31
+    /**
32
+     * Read master pid and manager pid from pid file
33
+     *
34
+     * @return string[] {
35
+     *	 @var string $masterPid
36
+     *	 @var string $managerPid
37
+     * }
38
+     */
39
+    public function read(): array
40
+    {
41
+        $pids = [];
42 42
 
43
-		if (is_readable($this->pidFile)) {
44
-			$content = file_get_contents($this->pidFile);
45
-			$pids = explode(',', $content);
46
-		}
43
+        if (is_readable($this->pidFile)) {
44
+            $content = file_get_contents($this->pidFile);
45
+            $pids = explode(',', $content);
46
+        }
47 47
 
48
-		return $pids;
49
-	}
48
+        return $pids;
49
+    }
50 50
 
51
-	/**
52
-	 * Gets pid file path.
53
-	 *
54
-	 * @return string
55
-	 */
56
-	public function file()
57
-	{
58
-		return $this->pidFile;
59
-	}
51
+    /**
52
+     * Gets pid file path.
53
+     *
54
+     * @return string
55
+     */
56
+    public function file()
57
+    {
58
+        return $this->pidFile;
59
+    }
60 60
 
61
-	/**
62
-	 * Delete pid file
63
-	 */
64
-	public function delete(): bool
65
-	{
66
-		if (is_writable($this->pidFile)) {
67
-			return unlink($this->pidFile);
68
-		}
61
+    /**
62
+     * Delete pid file
63
+     */
64
+    public function delete(): bool
65
+    {
66
+        if (is_writable($this->pidFile)) {
67
+            return unlink($this->pidFile);
68
+        }
69 69
 
70
-		return false;
71
-	}
70
+        return false;
71
+    }
72 72
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 */
22 22
 	public function write(int $masterPid, int $managerPid): void
23 23
 	{
24
-		if (! is_writable($this->pidFile) && ! is_writable(dirname($this->pidFile))) {
24
+		if (!is_writable($this->pidFile) && !is_writable(dirname($this->pidFile))) {
25 25
 			throw new \RuntimeException(sprintf('Pid file "%s" is not writable', $this->pidFile));
26 26
 		}
27 27
 
Please login to merge, or discard this patch.
src/Server/PidManagerFactory.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 
8 8
 class PidManagerFactory
9 9
 {
10
-	public function __invoke(ContainerInterface $container): PidManager
11
-	{
12
-		return new PidManager(
13
-			$container->get('config')->get('swoole_http.server.options.pid_file') ?? sys_get_temp_dir() . '/swoole.pid'
14
-		);
15
-	}
10
+    public function __invoke(ContainerInterface $container): PidManager
11
+    {
12
+        return new PidManager(
13
+            $container->get('config')->get('swoole_http.server.options.pid_file') ?? sys_get_temp_dir() . '/swoole.pid'
14
+        );
15
+    }
16 16
 }
Please login to merge, or discard this patch.