Completed
Pull Request — master (#2)
by thomas
03:48 queued 31s
created
Category
src/Client.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * @param array $params
32 32
      * @return \React\Promise\Promise
33 33
      */
34
-    public function request($method, array $params = [])
34
+    public function request($method, array $params = [ ])
35 35
     {
36 36
         return $this->executor->query($this->requestFactory->create($method, $params));
37 37
     }
Please login to merge, or discard this patch.
src/Request/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     /**
18 18
      * @var array
19 19
      */
20
-    private $params = [];
20
+    private $params = [ ];
21 21
 
22 22
     /**
23 23
      * @param string $method
Please login to merge, or discard this patch.
src/Request/RequestFactory.php 1 patch
Spacing   +6 added lines, -6 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 $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
-            if (!isset($decoded['id'])) {
38
+            if (!isset($decoded[ 'id' ])) {
39 39
                 throw new \Exception('Response missing id');
40 40
             }
41 41
 
42
-            if (isset($decoded['error'])) {
43
-                throw new ApiError($decoded['id'], $decoded['error']);
44
-            } elseif ($decoded['result']) {
45
-                return new Response($decoded['id'], $decoded['result']);
42
+            if (isset($decoded[ 'error' ])) {
43
+                throw new ApiError($decoded[ 'id' ], $decoded[ 'error' ]);
44
+            } elseif ($decoded[ 'result' ]) {
45
+                return new Response($decoded[ 'id' ], $decoded[ 'result' ]);
46 46
             }
47 47
 
48 48
             throw new \Exception('Response missing error or result');
Please login to merge, or discard this patch.
src/Executor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $deferred = new Deferred();
67 67
 
68
-        $this->createConnection()->then(function (Stream $stream) use ($deferred, $request, &$steamBuffer) {
68
+        $this->createConnection()->then(function(Stream $stream) use ($deferred, $request, &$steamBuffer) {
69 69
             $streamBuffer = '';
70
-            $stream->on('data', function ($data) use ($deferred, $stream, $request, &$streamBuffer) {
70
+            $stream->on('data', function($data) use ($deferred, $stream, $request, &$streamBuffer) {
71 71
                 if (substr($data, strlen($data) - 1) == "\n") {
72 72
                     $stream->close();
73 73
                     $deferred->resolve($this->requestFactory->response($streamBuffer . $data));
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             });
80 80
 
81 81
             $stream->write($request->write());
82
-        }, function () use ($deferred) {
82
+        }, function() use ($deferred) {
83 83
             $deferred->reject(new \ErrorException('Failed to connect to host'));
84 84
         });
85 85
 
Please login to merge, or discard this patch.
examples.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@
 block discarded – undo
21 21
 $clientFactory = new Factory($loop, $connector, $requestFactory);
22 22
 $stratum = $clientFactory->create($host, $port);
23 23
 
24
-$v = $stratum->request('server.version', ['1.9.7', ' 0.6'])->then(function (Response $r) {
24
+$v = $stratum->request('server.version', [ '1.9.7', ' 0.6' ])->then(function(Response $r) {
25 25
     echo "Server version: " . $r->getResult() . "\n";
26 26
 });
27 27
 
28 28
 // Make the query, receive a Promise
29
-$t = $stratum->request('blockchain.address.get_balance', ['1NfcqVqW4f6tACwaqjyKXRV75aqt3VEVPE']);
30
-$t->then(function (Response $response) {
29
+$t = $stratum->request('blockchain.address.get_balance', [ '1NfcqVqW4f6tACwaqjyKXRV75aqt3VEVPE' ]);
30
+$t->then(function(Response $response) {
31 31
     var_dump($response);
32
-}, function (\BitWasp\Stratum\Exceptions\ApiError $error) {
32
+}, function(\BitWasp\Stratum\Exceptions\ApiError $error) {
33 33
     echo sprintf(" [id: %s] error: %s", $error->getId(), $error->getMessage());
34
-}, function () {
34
+}, function() {
35 35
 
36 36
 });
37 37
 
Please login to merge, or discard this patch.