Passed
Pull Request — master (#233)
by Pavel
02:21
created
src/Http/Middleware/JsonPayloadMiddleware.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
45 45
     {
46
-        if ($this->isJsonPayload($request)) {
46
+        if ($this->isJsonPayload($request)){
47 47
             $request = $request->withParsedBody(json_decode((string)$request->getBody(), true));
48
-            if (json_last_error() !== 0) {
48
+            if (json_last_error() !== 0){
49 49
                 throw new ClientException(400, 'invalid json payload');
50 50
             }
51 51
         }
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $contentType = $request->getHeaderLine('Content-Type');
63 63
 
64
-        foreach ($this->config->getContentTypes() as $allowedType) {
65
-            if (stripos($contentType, $allowedType) === 0) {
64
+        foreach ($this->config->getContentTypes() as $allowedType){
65
+            if (stripos($contentType, $allowedType) === 0){
66 66
                 return true;
67 67
             }
68 68
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,9 +43,11 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
45 45
     {
46
-        if ($this->isJsonPayload($request)) {
46
+        if ($this->isJsonPayload($request))
47
+        {
47 48
             $request = $request->withParsedBody(json_decode((string)$request->getBody(), true));
48
-            if (json_last_error() !== 0) {
49
+            if (json_last_error() !== 0)
50
+            {
49 51
                 throw new ClientException(400, 'invalid json payload');
50 52
             }
51 53
         }
@@ -61,8 +63,10 @@  discard block
 block discarded – undo
61 63
     {
62 64
         $contentType = $request->getHeaderLine('Content-Type');
63 65
 
64
-        foreach ($this->config->getContentTypes() as $allowedType) {
65
-            if (stripos($contentType, $allowedType) === 0) {
66
+        foreach ($this->config->getContentTypes() as $allowedType)
67
+        {
68
+            if (stripos($contentType, $allowedType) === 0)
69
+            {
66 70
                 return true;
67 71
             }
68 72
         }
Please login to merge, or discard this patch.