Passed
Pull Request — master (#271)
by Bill
03:10
created
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,12 +7,12 @@
 block discarded – undo
7 7
 
8 8
 class PidManagerFactory
9 9
 {
10
-	public function __invoke(ContainerInterface $container): PidManager
11
-	{
10
+    public function __invoke(ContainerInterface $container): PidManager
11
+    {
12 12
         $config = $container->get('config');
13 13
 
14
-		return new PidManager(
15
-			$config->get('swoole_http.server.options.pid_file') ?: sys_get_temp_dir() . '/swoole.pid'
16
-		);
17
-	}
14
+        return new PidManager(
15
+            $config->get('swoole_http.server.options.pid_file') ?: sys_get_temp_dir() . '/swoole.pid'
16
+        );
17
+    }
18 18
 }
Please login to merge, or discard this patch.