Passed
Pull Request — master (#625)
by Aleksei
10:57
created
src/Http/tests/Stream/GeneratorStreamTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function testRewindAfterRead(): void
50 50
     {
51
-        if (PHP_VERSION_ID < 80000) {
51
+        if (PHP_VERSION_ID < 80000){
52 52
             $this->markTestSkipped('See issue https://bugs.php.net/bug.php?id=79927.');
53 53
         }
54 54
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
         $rValue = 'return-value';
104 104
         $stream = $this->createStream(self::DEFAULT_SEQUENCE, $rValue);
105 105
 
106
-        $result = (string) $stream;
106
+        $result = (string)$stream;
107 107
 
108
-        $this->assertSame(self::DEFAULT_CONTENT_RESULT . $rValue, $result);
108
+        $this->assertSame(self::DEFAULT_CONTENT_RESULT.$rValue, $result);
109 109
     }
110 110
 
111 111
     public function testToStringWithReturnOnly(): void
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $rValue = 'return-value';
114 114
         $stream = $this->createStream([], $rValue);
115 115
 
116
-        $result = (string) $stream;
116
+        $result = (string)$stream;
117 117
 
118 118
         $this->assertSame($rValue, $result);
119 119
     }
Please login to merge, or discard this patch.
src/Http/src/Stream/GeneratorStream.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __toString(): string
29 29
     {
30
-        try {
30
+        try{
31 31
             return $this->getContents();
32
-        } catch (\Exception $e) {
32
+        }catch (\Exception $e){
33 33
             return '';
34 34
         }
35 35
     }
36 36
 
37 37
     public function close(): void
38 38
     {
39
-        if ($this->stream !== null) {
39
+        if ($this->stream !== null){
40 40
             $this->detach();
41 41
         }
42 42
     }
43 43
 
44 44
     public function detach()
45 45
     {
46
-        if ($this->stream === null) {
46
+        if ($this->stream === null){
47 47
             return null;
48 48
         }
49 49
         $this->stream = null;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function rewind(): void
83 83
     {
84
-        if ($this->stream !== null) {
84
+        if ($this->stream !== null){
85 85
             $this->stream->rewind();
86 86
         }
87 87
         $this->caret = 0;
@@ -105,26 +105,26 @@  discard block
 block discarded – undo
105 105
 
106 106
     public function read($length): string
107 107
     {
108
-        if (!$this->readable) {
108
+        if (!$this->readable){
109 109
             throw new RuntimeException('Cannot read from non-readable stream.');
110 110
         }
111
-        if ($this->stream === null) {
111
+        if ($this->stream === null){
112 112
             throw new RuntimeException('Cannot read from detached stream.');
113 113
         }
114
-        do {
115
-            if ($this->started) {
114
+        do{
115
+            if ($this->started){
116 116
                 $read = (string)$this->stream->send(null);
117
-            } else {
117
+            }else{
118 118
                 $this->started = true;
119 119
                 $read = (string)$this->stream->current();
120 120
             }
121
-            if (!$this->stream->valid()) {
121
+            if (!$this->stream->valid()){
122 122
                 $read .= $this->stream->getReturn();
123 123
                 break;
124 124
             }
125
-        } while ($read === '');
125
+        }while ($read === '');
126 126
         $this->caret += \strlen($read);
127
-        if (!$this->stream->valid()) {
127
+        if (!$this->stream->valid()){
128 128
             $this->size = $this->caret;
129 129
         }
130 130
         return $read;
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function getContents(): string
134 134
     {
135
-        if ($this->stream === null) {
135
+        if ($this->stream === null){
136 136
             throw new RuntimeException('Unable to read stream contents.');
137 137
         }
138 138
         $content = '';
139
-        do {
139
+        do{
140 140
             $content .= $this->read(PHP_INT_MAX);
141
-        } while ($this->stream->valid());
141
+        }while ($this->stream->valid());
142 142
         return $content;
143 143
     }
144 144
 
145 145
     public function getMetadata($key = null)
146 146
     {
147
-        if ($this->stream === null) {
147
+        if ($this->stream === null){
148 148
             return $key ? null : [];
149 149
         }
150 150
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             'eof' => $this->eof(),
154 154
         ];
155 155
 
156
-        if (null === $key) {
156
+        if (null === $key){
157 157
             return $meta;
158 158
         }
159 159
 
Please login to merge, or discard this patch.
src/Router/src/CoreHandler.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         CoreInterface $core,
57 57
         ScopeInterface $scope,
58 58
         ResponseFactoryInterface $responseFactory
59
-    ) {
59
+    ){
60 60
         $this->core = $core;
61 61
         $this->scope = $scope;
62 62
         $this->responseFactory = $responseFactory;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function handle(Request $request): Response
96 96
     {
97
-        if ($this->controller === null) {
97
+        if ($this->controller === null){
98 98
             throw new HandlerException('Controller and action pair is not set');
99 99
         }
100 100
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $output = $result = null;
105 105
 
106 106
         $response = $this->responseFactory->createResponse(200);
107
-        try {
107
+        try{
108 108
             // run the core withing PSR-7 Request/Response scope
109 109
             $result = $this->scope->runScope(
110 110
                 [
@@ -119,29 +119,29 @@  discard block
 block discarded – undo
119 119
                     );
120 120
                 }
121 121
             );
122
-        } catch (ControllerException $e) {
122
+        }catch (ControllerException $e){
123 123
             ob_get_clean();
124 124
             throw $this->mapException($e);
125
-        } catch (\Throwable $e) {
125
+        }catch (\Throwable $e){
126 126
             ob_get_clean();
127 127
             throw $e;
128
-        } finally {
129
-            while (ob_get_level() > $outputLevel + 1) {
130
-                $output = ob_get_clean() . $output;
128
+        }finally{
129
+            while (ob_get_level() > $outputLevel + 1){
130
+                $output = ob_get_clean().$output;
131 131
             }
132 132
         }
133 133
 
134 134
         return $this->wrapResponse(
135 135
             $response,
136 136
             $result,
137
-            ob_get_clean() . $output
137
+            ob_get_clean().$output
138 138
         );
139 139
     }
140 140
 
141 141
     private function getAction(Request $request): string
142 142
     {
143
-        if ($this->verbActions) {
144
-            return strtolower($request->getMethod()) . ucfirst($this->action);
143
+        if ($this->verbActions){
144
+            return strtolower($request->getMethod()).ucfirst($this->action);
145 145
         }
146 146
 
147 147
         return $this->action;
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
158 158
     {
159
-        if ($result instanceof Response) {
160
-            if ($output !== '' && $result->getBody()->isWritable()) {
159
+        if ($result instanceof Response){
160
+            if ($output !== '' && $result->getBody()->isWritable()){
161 161
                 $result->getBody()->write($output);
162 162
             }
163 163
 
164 164
             return $result;
165 165
         }
166 166
 
167
-        if ($result instanceof \Generator) {
167
+        if ($result instanceof \Generator){
168 168
             return $response->withBody(new GeneratorStream($result));
169 169
         }
170 170
 
171
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
171
+        if (\is_array($result) || $result instanceof \JsonSerializable){
172 172
             $response = $this->writeJson($response, $result);
173
-        } else {
173
+        }else{
174 174
             $response->getBody()->write((string)$result);
175 175
         }
176 176
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     private function mapException(ControllerException $exception): ClientException
187 187
     {
188
-        switch ($exception->getCode()) {
188
+        switch ($exception->getCode()){
189 189
             case ControllerException::BAD_ACTION:
190 190
             case ControllerException::NOT_FOUND:
191 191
                 return new NotFoundException($exception->getMessage());
Please login to merge, or discard this patch.