@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getServerVersion($clientVersion, $protocolVersion) |
| 50 | 50 | { |
| 51 | - return $this->conn->request(self::SERVER_VERSION, [$clientVersion, $protocolVersion]); |
|
| 51 | + return $this->conn->request(self::SERVER_VERSION, [ $clientVersion, $protocolVersion ]); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function subscribeAddress($address) |
| 99 | 99 | { |
| 100 | - return $this->conn->request(self::ADDRESS_SUBSCRIBE, [$address]); |
|
| 100 | + return $this->conn->request(self::ADDRESS_SUBSCRIBE, [ $address ]); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function transactionBroadcast($hex) |
| 108 | 108 | { |
| 109 | - return $this->conn->request(self::TRANSACTION_BROADCAST, [$hex]); |
|
| 109 | + return $this->conn->request(self::TRANSACTION_BROADCAST, [ $hex ]); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function transactionGetMerkle($txid, $height) |
| 118 | 118 | { |
| 119 | - return $this->conn->request(self::TRANSACTION_GET_MERKLE, [$txid, $height]); |
|
| 119 | + return $this->conn->request(self::TRANSACTION_GET_MERKLE, [ $txid, $height ]); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function transactionGet($txid) |
| 127 | 127 | { |
| 128 | - return $this->conn->request(self::TRANSACTION_GET, [$txid]); |
|
| 128 | + return $this->conn->request(self::TRANSACTION_GET, [ $txid ]); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function addressGetHistory($address) |
| 136 | 136 | { |
| 137 | - return $this->conn->request(self::ADDRESS_GET_HISTORY, [$address]); |
|
| 137 | + return $this->conn->request(self::ADDRESS_GET_HISTORY, [ $address ]); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function addressGetBalance($address) |
| 145 | 145 | { |
| 146 | - return $this->conn->request(self::ADDRESS_GET_BALANCE, [$address]); |
|
| 146 | + return $this->conn->request(self::ADDRESS_GET_BALANCE, [ $address ]); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function addressGetProof($address) |
| 154 | 154 | { |
| 155 | - return $this->conn->request(self::ADDRESS_GET_PROOF, [$address]); |
|
| 155 | + return $this->conn->request(self::ADDRESS_GET_PROOF, [ $address ]); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function addressListUnspent($address) |
| 163 | 163 | { |
| 164 | - return $this->conn->request(self::ADDRESS_LIST_UNSPENT, [$address]); |
|
| 164 | + return $this->conn->request(self::ADDRESS_LIST_UNSPENT, [ $address ]); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function addressGetMempool($address) |
| 172 | 172 | { |
| 173 | - return $this->conn->request(self::ADDRESS_GET_MEMPOOL, [$address]); |
|
| 173 | + return $this->conn->request(self::ADDRESS_GET_MEMPOOL, [ $address ]); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function utxoGetAddress($txid, $nOutput) |
| 182 | 182 | { |
| 183 | - return $this->conn->request(self::UTXO_GET_ADDRESS, [$txid, $nOutput]); |
|
| 183 | + return $this->conn->request(self::UTXO_GET_ADDRESS, [ $txid, $nOutput ]); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function blockGetHeader($blockHeight) |
| 207 | 207 | { |
| 208 | - return $this->conn->request(self::BLOCK_GET_HEADER, [$blockHeight]); |
|
| 208 | + return $this->conn->request(self::BLOCK_GET_HEADER, [ $blockHeight ]); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -214,6 +214,6 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function blockGetChunk($blockHeight) |
| 216 | 216 | { |
| 217 | - return $this->conn->request(self::BLOCK_GET_CHUNK, [$blockHeight]); |
|
| 217 | + return $this->conn->request(self::BLOCK_GET_CHUNK, [ $blockHeight ]); |
|
| 218 | 218 | } |
| 219 | 219 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function authorize($user, $password) |
| 43 | 43 | { |
| 44 | - return $this->conn->request(self::AUTHORIZE, [$user, $password]); |
|
| 44 | + return $this->conn->request(self::AUTHORIZE, [ $user, $password ]); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -54,6 +54,6 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function submit($worker_name, $job_id, $extranonce2, $ntime, $nonce) |
| 56 | 56 | { |
| 57 | - return $this->conn->request(self::SUBMIT, [$worker_name, $job_id, $extranonce2, $ntime, $nonce]); |
|
| 57 | + return $this->conn->request(self::SUBMIT, [ $worker_name, $job_id, $extranonce2, $ntime, $nonce ]); |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -48,6 +48,6 @@ |
||
| 48 | 48 | return json_encode([ |
| 49 | 49 | 'id' => $this->id, |
| 50 | 50 | 'result' => $this->result |
| 51 | - ]) . "\n"; |
|
| 51 | + ])."\n"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var array |
| 11 | 11 | */ |
| 12 | - private $nonces = []; |
|
| 12 | + private $nonces = [ ]; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @param $method |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | $decoded = json_decode(trim($string), true); |
| 37 | 37 | |
| 38 | 38 | if (json_last_error() === JSON_ERROR_NONE) { |
| 39 | - $id = isset($decoded['id']) ? $decoded['id'] : null; |
|
| 40 | - |
|
| 41 | - if (isset($decoded['error'])) { |
|
| 42 | - throw new ApiError($id, $decoded['error']); |
|
| 43 | - } elseif (isset($decoded['method']) && isset($decoded['params'])) { |
|
| 44 | - return new Request($id, $decoded['method'], $decoded['params']); |
|
| 45 | - } elseif (isset($decoded['result'])) { |
|
| 46 | - return new Response($id, $decoded['result']); |
|
| 39 | + $id = isset($decoded[ 'id' ]) ? $decoded[ 'id' ] : null; |
|
| 40 | + |
|
| 41 | + if (isset($decoded[ 'error' ])) { |
|
| 42 | + throw new ApiError($id, $decoded[ 'error' ]); |
|
| 43 | + } elseif (isset($decoded[ 'method' ]) && isset($decoded[ 'params' ])) { |
|
| 44 | + return new Request($id, $decoded[ 'method' ], $decoded[ 'params' ]); |
|
| 45 | + } elseif (isset($decoded[ 'result' ])) { |
|
| 46 | + return new Response($id, $decoded[ 'result' ]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | throw new \Exception('Response missing error/params/result'); |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function toRequest() |
| 36 | 36 | { |
| 37 | - return new Request(null, ElectrumClient::NUMBLOCKS_SUBSCRIBE, [$this->height]); |
|
| 37 | + return new Request(null, ElectrumClient::NUMBLOCKS_SUBSCRIBE, [ $this->height ]); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -139,10 +139,10 @@ |
||
| 139 | 139 | */ |
| 140 | 140 | public function toRequest() |
| 141 | 141 | { |
| 142 | - return new Request(null, ElectrumClient::HEADERS_SUBSCRIBE, [[ |
|
| 142 | + return new Request(null, ElectrumClient::HEADERS_SUBSCRIBE, [ [ |
|
| 143 | 143 | $this->nonce, $this->prevBlock, $this->timestamp, |
| 144 | 144 | $this->merkleRoot, $this->height, $this->utxoRoot, |
| 145 | 145 | $this->version, $this->bits |
| 146 | - ]]); |
|
| 146 | + ] ]); |
|
| 147 | 147 | } |
| 148 | 148 | } |
@@ -49,6 +49,6 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function toRequest() |
| 51 | 51 | { |
| 52 | - return new Request(null, ElectrumClient::ADDRESS_SUBSCRIBE, [$this->address, $this->txid]); |
|
| 52 | + return new Request(null, ElectrumClient::ADDRESS_SUBSCRIBE, [ $this->address, $this->txid ]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -154,6 +154,6 @@ |
||
| 154 | 154 | */ |
| 155 | 155 | public function toRequest() |
| 156 | 156 | { |
| 157 | - return new Request(null, MiningClient::MINING_SUBSCRIBE, [$this->job_id, $this->prevhash, $this->coinb1, $this->coinb2, $this->merkle_branch, $this->version, $this->nbits, $this->ntime, $this->clean_jobs]); |
|
| 157 | + return new Request(null, MiningClient::MINING_SUBSCRIBE, [ $this->job_id, $this->prevhash, $this->coinb1, $this->coinb2, $this->merkle_branch, $this->version, $this->nbits, $this->ntime, $this->clean_jobs ]); |
|
| 158 | 158 | } |
| 159 | 159 | } |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function toRequest() |
| 36 | 36 | { |
| 37 | - return new Request(null, MiningClient::SET_DIFFICULTY, [$this->difficulty]); |
|
| 37 | + return new Request(null, MiningClient::SET_DIFFICULTY, [ $this->difficulty ]); |
|
| 38 | 38 | } |
| 39 | 39 | } |