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