Completed
Pull Request — master (#113)
by thomas
20:21
created
src/Wallet.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         }
212 212
 
213 213
         $this->addressReader = $addressReader;
214
-        $this->isSegwit = (bool) $segwit;
214
+        $this->isSegwit = (bool)$segwit;
215 215
         $this->chainIndex = $chainIdx;
216 216
         $this->changeIndex = $changeIdx;
217 217
     }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      * @return array[]      [ [xpub, path] ]
271 271
      */
272 272
     public function getBlocktrailPublicKeys() {
273
-        return array_map(function (BIP32Key $key) {
273
+        return array_map(function(BIP32Key $key) {
274 274
             return $key->tuple();
275 275
         }, $this->blocktrailPublicKeys);
276 276
     }
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
     public function getAddressByPath($path) {
420 420
         $path = (string)BIP32Path::path($path)->privatePath();
421 421
         if (!isset($this->derivations[$path])) {
422
-            list($address, ) = $this->getRedeemScriptByPath($path);
422
+            list($address,) = $this->getRedeemScriptByPath($path);
423 423
 
424 424
             $this->derivations[$path] = $address;
425 425
             $this->derivationsByAddress[$address] = $path;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
             $signInfo[] = $utxo->getSignInfo();
760 760
         }
761 761
 
762
-        $utxoSum = array_sum(array_map(function (UTXO $utxo) {
762
+        $utxoSum = array_sum(array_map(function(UTXO $utxo) {
763 763
             return $utxo->value;
764 764
         }, $utxos));
765 765
         if ($utxoSum < array_sum(array_column($send, 'value'))) {
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
             throw new \Exception("Wallet needs to be unlocked to pay");
898 898
         }
899 899
 
900
-        assert(Util::all(function ($signInfo) {
900
+        assert(Util::all(function($signInfo) {
901 901
             return $signInfo instanceof SignInfo;
902 902
         }, $signInfo), '$signInfo should be SignInfo[]');
903 903
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
         ];
911 911
 
912 912
         // send the transaction
913
-        return $this->sendTransaction($txs, array_map(function (SignInfo $r) {
913
+        return $this->sendTransaction($txs, array_map(function(SignInfo $r) {
914 914
             return (string)$r->path;
915 915
         }, $signInfo), $apiCheckFee);
916 916
     }
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
     public static function estimateSizeUTXOs($utxoCnt) {
971 971
         $txinSize = 0;
972 972
 
973
-        for ($i=0; $i<$utxoCnt; $i++) {
973
+        for ($i = 0; $i < $utxoCnt; $i++) {
974 974
             // @TODO: proper size calculation, we only do multisig right now so it's hardcoded and then we guess the size ...
975 975
             $multisig = "2of3";
976 976
 
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
      * @return int
1052 1052
      */
1053 1053
     protected function determineChange($utxos, $outputs, $fee) {
1054
-        $inputsTotal = array_sum(array_map(function (UTXO $utxo) {
1054
+        $inputsTotal = array_sum(array_map(function(UTXO $utxo) {
1055 1055
             return $utxo->value;
1056 1056
         }, $utxos));
1057 1057
         $outputsTotal = array_sum(array_column($outputs, 'value'));
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
         $adapter = Bitcoin::getEcAdapter();
1072 1072
         $signer = new Signer($tx, $adapter);
1073 1073
 
1074
-        assert(Util::all(function ($signInfo) {
1074
+        assert(Util::all(function($signInfo) {
1075 1075
             return $signInfo instanceof SignInfo;
1076 1076
         }, $signInfo), '$signInfo should be SignInfo[]');
1077 1077
 
Please login to merge, or discard this patch.
src/WalletSweeper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $this->getBlocktrailPublicKey($path)->buildKey($path)->publicKey()
202 202
         ]), false);
203 203
 
204
-        if ($this->network !== "bitcoincash" && (int) $path[2] === 2) {
204
+        if ($this->network !== "bitcoincash" && (int)$path[2] === 2) {
205 205
             $witnessScript = new WitnessScript($multisig);
206 206
             $redeemScript = new P2shScript($witnessScript);
207 207
             $address = $this->addressReader->fromOutputScript($redeemScript->getOutputScript())->getAddress();
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         for ($i = 0; $i < $count; $i++) {
229 229
             //create a path subsequent address
230
-            $path = (string)WalletPath::create($keyIndex, $_chain = 0, $start+$i)->path()->publicPath();
230
+            $path = (string)WalletPath::create($keyIndex, $_chain = 0, $start + $i)->path()->publicPath();
231 231
             list($address, $redeem, $witness) = $this->createAddress($path);
232 232
             $addresses[$address] = array(
233 233
                 //'address' => $address,
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $totalUTXOs = 0;
277 277
         $totalAddressesGenerated = 0;
278 278
 
279
-        $addressUTXOs = array();    //addresses and their utxos, paths and redeem scripts
279
+        $addressUTXOs = array(); //addresses and their utxos, paths and redeem scripts
280 280
 
281 281
         //for each blocktrail pub key, do fund discovery on batches of addresses
282 282
         foreach ($this->blocktrailPublicKeys as $keyIndex => $blocktrailPubKey) {
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     }
313 313
 
314 314
                     $addressUTXOs[$address]['utxos'][] = $utxo;
315
-                    $totalUTXOs ++;
315
+                    $totalUTXOs++;
316 316
 
317 317
                     //add up the total utxo value for all addresses
318 318
                     $totalBalance += $utxo['value'];
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $signer->setCheckerCreator(BchCheckerCreator::fromEcAdapter($adapter));
440 440
         }
441 441
 
442
-        assert(Util::all(function ($signInfo) {
442
+        assert(Util::all(function($signInfo) {
443 443
             return $signInfo instanceof SignInfo;
444 444
         }, $signInfo), '$signInfo should be SignInfo[]');
445 445
 
Please login to merge, or discard this patch.