Completed
Pull Request — master (#63)
by Tobias
03:26
created
src/Driver/Userland/UserlandDaemonFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         $socket = fopen('php://fd/'.$fd, 'r');
32 32
 
33 33
         if (false === $socket) {
34
-            throw new \RuntimeException('Could not open ' . $fd);
34
+            throw new \RuntimeException('Could not open '.$fd);
35 35
         }
36 36
 
37 37
         return $this->createDaemonFromStreamSocket($kernel, $options, $socket);
Please login to merge, or discard this patch.
src/Command/DaemonRunCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
         $this->driverContainer = $driverContainer;
47 47
         $this->daemon          = null;
48 48
 
49
-        $name        = $name        ?: self::DEFAULT_NAME;
49
+        $name        = $name ?: self::DEFAULT_NAME;
50 50
         $description = $description ?: self::DEFAULT_DESCRIPTION;
51 51
 
52 52
         parent::__construct($name);
53 53
 
54 54
         $this
55 55
             ->setDescription($description)
56
-            ->addOption('port',          null, InputOption::VALUE_OPTIONAL, 'TCP port to listen on (if not present, daemon will listen on FCGI_LISTENSOCK_FILENO)')
57
-            ->addOption('host',          null, InputOption::VALUE_OPTIONAL, 'TCP host to listen on')
58
-            ->addOption('fd',            null, InputOption::VALUE_OPTIONAL, 'File descriptor to listen on - defaults to FCGI_LISTENSOCK_FILENO', DaemonInterface::FCGI_LISTENSOCK_FILENO)
56
+            ->addOption('port', null, InputOption::VALUE_OPTIONAL, 'TCP port to listen on (if not present, daemon will listen on FCGI_LISTENSOCK_FILENO)')
57
+            ->addOption('host', null, InputOption::VALUE_OPTIONAL, 'TCP host to listen on')
58
+            ->addOption('fd', null, InputOption::VALUE_OPTIONAL, 'File descriptor to listen on - defaults to FCGI_LISTENSOCK_FILENO', DaemonInterface::FCGI_LISTENSOCK_FILENO)
59 59
             ->addOption('request-limit', null, InputOption::VALUE_OPTIONAL, 'The maximum number of requests to handle before shutting down')
60
-            ->addOption('memory-limit',  null, InputOption::VALUE_OPTIONAL, 'The memory limit on the daemon instance before shutting down')
61
-            ->addOption('time-limit',    null, InputOption::VALUE_OPTIONAL, 'The time limit on the daemon in seconds before shutting down')
62
-            ->addOption('auto-shutdown', null, InputOption::VALUE_NONE,     'Perform a graceful shutdown after receiving a 5XX HTTP status code')
63
-            ->addOption('driver',        null, InputOption::VALUE_OPTIONAL, 'The implementation of the FastCGI protocol to use', 'userland');
60
+            ->addOption('memory-limit', null, InputOption::VALUE_OPTIONAL, 'The memory limit on the daemon instance before shutting down')
61
+            ->addOption('time-limit', null, InputOption::VALUE_OPTIONAL, 'The time limit on the daemon in seconds before shutting down')
62
+            ->addOption('auto-shutdown', null, InputOption::VALUE_NONE, 'Perform a graceful shutdown after receiving a 5XX HTTP status code')
63
+            ->addOption('driver', null, InputOption::VALUE_OPTIONAL, 'The implementation of the FastCGI protocol to use', 'userland');
64 64
     }
65 65
 
66 66
     /**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
         $logger = new ConsoleLogger($output);
78 78
 
79 79
         $requestLimit = $input->getOption('request-limit') ?: DaemonOptions::NO_LIMIT;
80
-        $memoryLimit  = $input->getOption('memory-limit')  ?: DaemonOptions::NO_LIMIT;
81
-        $timeLimit    = $input->getOption('time-limit')    ?: DaemonOptions::NO_LIMIT;
80
+        $memoryLimit  = $input->getOption('memory-limit') ?: DaemonOptions::NO_LIMIT;
81
+        $timeLimit    = $input->getOption('time-limit') ?: DaemonOptions::NO_LIMIT;
82 82
         $autoShutdown = $input->getOption('auto-shutdown');
83 83
 
84 84
         return new DaemonOptions([
Please login to merge, or discard this patch.
src/Driver/Userland/Connection/StreamSocketConnectionPool.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
             $readSockets = [];
136 136
         } else {
137 137
             $res = [];
138
-            foreach($read as $socket) {
138
+            foreach ($read as $socket) {
139 139
                 $res[array_search($socket, $readSockets)] = $socket;
140 140
             }
141 141
             $readSockets = $res;
Please login to merge, or discard this patch.
src/Http/Request.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $this->params[strtoupper($name)] = $value;
52 52
         }
53 53
 
54
-        $this->stdin  = $stdin;
54
+        $this->stdin = $stdin;
55 55
 
56 56
         rewind($this->stdin);
57 57
     }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
         while (!feof($stream)) {
152 152
             $getContent = $fieldName && !$inHeader;
153
-            $buffer = stream_get_line($stream, static::$bufferSize,  "\n" . ($getContent ? '--'.$boundary : ''));
153
+            $buffer = stream_get_line($stream, static::$bufferSize, "\n".($getContent ? '--'.$boundary : ''));
154 154
             $buffer = trim($buffer, "\r");
155 155
 
156 156
             // Find the empty line between headers and body
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
             if ($getContent) {
164 164
                 if ($fieldType === 'data') {
165
-                    $post .= (isset($post[0]) ? '&' : '') . $fieldName . "=" . urlencode($buffer);
165
+                    $post .= (isset($post[0]) ? '&' : '').$fieldName."=".urlencode($buffer);
166 166
                 } elseif ($fieldType === 'file' && $filename) {
167 167
                     $tmpPath = @tempnam($this->getUploadDir(), 'fastcgi_upload');
168 168
                     $err = file_put_contents($tmpPath, $buffer);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 }
296 296
 
297 297
                 $trimmedMatch = trim($part, '[]');
298
-                if ($i === $count -1) {
298
+                if ($i === $count - 1) {
299 299
                     $current[$trimmedMatch] = $data;
300 300
                 } else {
301 301
                     $current = &$current[$trimmedMatch];
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -153,6 +153,9 @@
 block discarded – undo
153 153
         return $post ?: [];
154 154
     }
155 155
 
156
+    /**
157
+     * @param resource $stream
158
+     */
156 159
     private function parseMultipartFormData($stream, string $boundary): array {
157 160
         $post = "";
158 161
         $files = [];
Please login to merge, or discard this patch.
src/DaemonTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         if ($this->autoShutdown) {
84 84
             foreach ($statusCodes as $statusCode) {
85 85
                 if ($statusCode >= 500 && $statusCode < 600) {
86
-                    $this->flagShutdown('Automatic shutdown following status code: ' . $statusCode);
86
+                    $this->flagShutdown('Automatic shutdown following status code: '.$statusCode);
87 87
                     break;
88 88
                 }
89 89
             }
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function installSignalHandlers(): void
100 100
     {
101
-        declare (ticks = 1);
101
+        declare(ticks=1);
102 102
 
103
-        pcntl_signal(SIGINT, function () {
103
+        pcntl_signal(SIGINT, function() {
104 104
             throw new ShutdownException('Daemon shutdown requested (received SIGINT)');
105 105
         });
106 106
 
107
-        pcntl_signal(SIGALRM, function () {
107
+        pcntl_signal(SIGALRM, function() {
108 108
             throw new ShutdownException('Daemon time limit reached (received SIGALRM)');
109 109
         });
110 110
     }
Please login to merge, or discard this patch.