Completed
Pull Request — master (#8)
by
unknown
22:27
created
src/Request/RequestFactory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * @var array
11 11
      */
12
-    private $nonces = [];
12
+    private $nonces = [ ];
13 13
 
14 14
     /**
15 15
      * @param string $method
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
         $decoded = json_decode(trim($string), true);
36 36
 
37 37
         if (json_last_error() === JSON_ERROR_NONE) {
38
-            $id = isset($decoded['id']) ? $decoded['id'] : null;
39
-
40
-            if (isset($decoded['error'])) {
41
-                return new ApiError($id, $decoded['error']);
42
-            } elseif (isset($decoded['method']) && isset($decoded['params'])) {
43
-                return new Request($id, $decoded['method'], $decoded['params']);
44
-            } elseif (isset($decoded['result'])) {
45
-                return new Response($id, $decoded['result']);
38
+            $id = isset($decoded[ 'id' ]) ? $decoded[ 'id' ] : null;
39
+
40
+            if (isset($decoded[ 'error' ])) {
41
+                return new ApiError($id, $decoded[ 'error' ]);
42
+            } elseif (isset($decoded[ 'method' ]) && isset($decoded[ 'params' ])) {
43
+                return new Request($id, $decoded[ 'method' ], $decoded[ 'params' ]);
44
+            } elseif (isset($decoded[ 'result' ])) {
45
+                return new Response($id, $decoded[ 'result' ]);
46 46
             }
47 47
 
48 48
             throw new \Exception('Response missing error/params/result');
Please login to merge, or discard this patch.
src/Exception/ApiError.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
         return json_encode([
36 36
             'id' => $this->id,
37 37
             'error' => $this->getMessage()
38
-        ]) . "\n";
38
+        ])."\n";
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
     public function connect($host, $port)
38 38
     {
39 39
         $uri = $host.':'.$port;
40
-        return $this->connector->connect($uri)->then(function (Stream $stream) {
40
+        return $this->connector->connect($uri)->then(function(Stream $stream) {
41 41
             return new Connection($stream, $this->requestFactory);
42
-        }, function (\Exception $e) {
42
+        }, function(\Exception $e) {
43 43
             throw $e;
44 44
         });
45 45
     }
Please login to merge, or discard this patch.