Passed
Pull Request — master (#661)
by Maxim
07:57
created
src/Framework/Bootloader/Http/HttpBootloader.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
             $kernel->addDispatcher($factory->make(SapiDispatcher::class));
83 83
         });
84 84
 
85
-        if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher')) {
86
-            if (class_exists(PSR7Client::class)) {
85
+        if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher')){
86
+            if (class_exists(PSR7Client::class)){
87 87
                 $kernel->addDispatcher($factory->make(LegacyRrDispatcher::class));
88 88
             }
89 89
 
90
-            if (class_exists(PSR7Worker::class)) {
90
+            if (class_exists(PSR7Worker::class)){
91 91
                 $kernel->addDispatcher($factory->make(RrDispatcher::class));
92 92
             }
93 93
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $emitter = new SapiEmitter();
133 133
 
134
-        if (($chunkSize = $config->getChunkSize()) !== null) {
134
+        if (($chunkSize = $config->getChunkSize()) !== null){
135 135
             $emitter->bufferSize = $chunkSize;
136 136
         }
137 137
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,12 +82,15 @@  discard block
 block discarded – undo
82 82
             $kernel->addDispatcher($factory->make(SapiDispatcher::class));
83 83
         });
84 84
 
85
-        if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher')) {
86
-            if (class_exists(PSR7Client::class)) {
85
+        if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher'))
86
+        {
87
+            if (class_exists(PSR7Client::class))
88
+            {
87 89
                 $kernel->addDispatcher($factory->make(LegacyRrDispatcher::class));
88 90
             }
89 91
 
90
-            if (class_exists(PSR7Worker::class)) {
92
+            if (class_exists(PSR7Worker::class))
93
+            {
91 94
                 $kernel->addDispatcher($factory->make(RrDispatcher::class));
92 95
             }
93 96
         }
@@ -131,7 +134,8 @@  discard block
 block discarded – undo
131 134
     {
132 135
         $emitter = new SapiEmitter();
133 136
 
134
-        if (($chunkSize = $config->getChunkSize()) !== null) {
137
+        if (($chunkSize = $config->getChunkSize()) !== null)
138
+        {
135 139
             $emitter->bufferSize = $chunkSize;
136 140
         }
137 141
 
Please login to merge, or discard this patch.
src/Http/src/Config/HttpConfig.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@
 block discarded – undo
58 58
      */
59 59
     public function getChunkSize(): ?int
60 60
     {
61
-        if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) {
61
+        if (\is_null($this->config['chunkSize']) || (int)$this->config['chunkSize'] < 0){
62 62
             return null;
63 63
         }
64 64
 
65
-        return (int) $this->config['chunkSize'];
65
+        return (int)$this->config['chunkSize'];
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@
 block discarded – undo
58 58
      */
59 59
     public function getChunkSize(): ?int
60 60
     {
61
-        if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) {
61
+        if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0)
62
+        {
62 63
             return null;
63 64
         }
64 65
 
Please login to merge, or discard this patch.
src/Http/src/Emitter/SapiEmitter.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
     private function emitBody(ResponseInterface $response): void
55 55
     {
56 56
         $body = $response->getBody();
57
-        if ($body->isSeekable()) {
57
+        if ($body->isSeekable()){
58 58
             $body->rewind();
59 59
         }
60
-        if (!$body->isReadable()) {
60
+        if (!$body->isReadable()){
61 61
             return;
62 62
         }
63
-        if ($this->bufferSize === 0) {
63
+        if ($this->bufferSize === 0){
64 64
             echo $body;
65 65
         }
66
-        while (!$body->eof()) {
66
+        while (!$body->eof()){
67 67
             echo $body->read($this->bufferSize);
68 68
             flush();
69 69
         }
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function assertNoPreviousOutput(): void
82 82
     {
83
-        if (headers_sent()) {
83
+        if (headers_sent()){
84 84
             throw new EmitterException('Unable to emit response, headers already send.');
85 85
         }
86 86
 
87
-        if (ob_get_level() > 0 && ob_get_length() > 0) {
87
+        if (ob_get_level() > 0 && ob_get_length() > 0){
88 88
             throw new EmitterException('Unable to emit response, found non closed buffered output.');
89 89
         }
90 90
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             'HTTP/%s %d%s',
111 111
             $response->getProtocolVersion(),
112 112
             $statusCode,
113
-            ($reasonPhrase ? ' ' . $reasonPhrase : '')
113
+            ($reasonPhrase ? ' '.$reasonPhrase : '')
114 114
         ), true, $statusCode);
115 115
     }
116 116
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $statusCode = $response->getStatusCode();
130 130
 
131
-        foreach ($response->getHeaders() as $header => $values) {
131
+        foreach ($response->getHeaders() as $header => $values){
132 132
             $name = $this->filterHeader($header);
133 133
             $first = $name === 'Set-Cookie' ? false : true;
134
-            foreach ($values as $value) {
134
+            foreach ($values as $value){
135 135
                 header(sprintf(
136 136
                     '%s: %s',
137 137
                     $name,
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,16 +54,20 @@  discard block
 block discarded – undo
54 54
     private function emitBody(ResponseInterface $response): void
55 55
     {
56 56
         $body = $response->getBody();
57
-        if ($body->isSeekable()) {
57
+        if ($body->isSeekable())
58
+        {
58 59
             $body->rewind();
59 60
         }
60
-        if (!$body->isReadable()) {
61
+        if (!$body->isReadable())
62
+        {
61 63
             return;
62 64
         }
63
-        if ($this->bufferSize === 0) {
65
+        if ($this->bufferSize === 0)
66
+        {
64 67
             echo $body;
65 68
         }
66
-        while (!$body->eof()) {
69
+        while (!$body->eof())
70
+        {
67 71
             echo $body->read($this->bufferSize);
68 72
             flush();
69 73
         }
@@ -80,11 +84,13 @@  discard block
 block discarded – undo
80 84
      */
81 85
     private function assertNoPreviousOutput(): void
82 86
     {
83
-        if (headers_sent()) {
87
+        if (headers_sent())
88
+        {
84 89
             throw new EmitterException('Unable to emit response, headers already send.');
85 90
         }
86 91
 
87
-        if (ob_get_level() > 0 && ob_get_length() > 0) {
92
+        if (ob_get_level() > 0 && ob_get_length() > 0)
93
+        {
88 94
             throw new EmitterException('Unable to emit response, found non closed buffered output.');
89 95
         }
90 96
     }
@@ -128,10 +134,12 @@  discard block
 block discarded – undo
128 134
     {
129 135
         $statusCode = $response->getStatusCode();
130 136
 
131
-        foreach ($response->getHeaders() as $header => $values) {
137
+        foreach ($response->getHeaders() as $header => $values)
138
+        {
132 139
             $name = $this->filterHeader($header);
133 140
             $first = $name === 'Set-Cookie' ? false : true;
134
-            foreach ($values as $value) {
141
+            foreach ($values as $value)
142
+            {
135 143
                 header(sprintf(
136 144
                     '%s: %s',
137 145
                     $name,
Please login to merge, or discard this patch.