Completed
Pull Request — master (#87)
by thomas
18:16 queued 16:00
created
src/Wallet.php 2 patches
Doc Comments   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     }
192 192
 
193 193
     /**
194
-     * @param null $chainIndex
194
+     * @param null|integer $chainIndex
195 195
      * @return BIP32Path
196 196
      */
197 197
     protected function getWalletPath($chainIndex = null) {
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     }
328 328
 
329 329
     /**
330
-     * @param string|BIP32Path  $path
330
+     * @param BIP32Path  $path
331 331
      * @return BIP32Key|false
332 332
      * @throws \Exception
333 333
      *
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     /**
355 355
      * get address for the specified path
356 356
      *
357
-     * @param string|BIP32Path  $path
357
+     * @param string  $path
358 358
      * @return string
359 359
      */
360 360
     public function getAddressByPath($path) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
     }
455 455
 
456 456
     /**
457
-     * @param string|BIP32Path  $path
457
+     * @param BIP32Path  $path
458 458
      * @return BIP32Key
459 459
      * @throws \Exception
460 460
      */
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
      * 'fund' the txBuilder with UTXOs (modified in place)
606 606
      *
607 607
      * @param TransactionBuilder    $txBuilder
608
-     * @param bool|true             $lockUTXOs
608
+     * @param boolean             $lockUTXOs
609 609
      * @param bool|false            $allowZeroConf
610 610
      * @param null|int              $forceFee
611 611
      * @return TransactionBuilder
@@ -735,6 +735,10 @@  discard block
 block discarded – undo
735 735
         return [$txb->get(), $signInfo];
736 736
     }
737 737
 
738
+    /**
739
+     * @param integer $optimalFeePerKB
740
+     * @param integer $lowPriorityFeePerKB
741
+     */
738 742
     public function determineFeeAndChange(TransactionBuilder $txBuilder, $optimalFeePerKB, $lowPriorityFeePerKB) {
739 743
         $send = $txBuilder->getOutputs();
740 744
         $utxos = $txBuilder->getUtxos();
@@ -846,7 +850,7 @@  discard block
 block discarded – undo
846 850
      * @todo: mark this as deprecated, insist on the utxo's or qualified scripts.
847 851
      * @param int $utxoCnt      number of unspent inputs in transaction
848 852
      * @param int $outputCnt    number of outputs in transaction
849
-     * @return float
853
+     * @return integer
850 854
      * @access public           reminder that people might use this!
851 855
      */
852 856
     public static function estimateFee($utxoCnt, $outputCnt) {
@@ -869,7 +873,7 @@  discard block
 block discarded – undo
869 873
      * @todo: variable varint
870 874
      * @param int $txinSize
871 875
      * @param int $txoutSize
872
-     * @return float
876
+     * @return integer
873 877
      */
874 878
     public static function estimateSize($txinSize, $txoutSize) {
875 879
         return 4 + 4 + $txinSize + 4 + $txoutSize + 4; // version + txinVarInt + txin + txoutVarInt + txout + locktime
@@ -879,7 +883,7 @@  discard block
 block discarded – undo
879 883
      * only supports estimating size for P2PKH/P2SH outputs
880 884
      *
881 885
      * @param int $outputCnt    number of outputs in transaction
882
-     * @return float
886
+     * @return integer
883 887
      */
884 888
     public static function estimateSizeOutputs($outputCnt) {
885 889
         return ($outputCnt * 34);
@@ -934,7 +938,7 @@  discard block
 block discarded – undo
934 938
      *
935 939
      * @param UTXO[]  $utxos
936 940
      * @param array[] $outputs
937
-     * @param         $feeStrategy
941
+     * @param         string $feeStrategy
938 942
      * @param         $optimalFeePerKB
939 943
      * @param         $lowPriorityFeePerKB
940 944
      * @return int
@@ -1034,8 +1038,8 @@  discard block
 block discarded – undo
1034 1038
      * @param \array[] $outputs
1035 1039
      * @param bool $lockUTXO
1036 1040
      * @param bool $allowZeroConf
1037
-     * @param int|null|string $feeStrategy
1038
-     * @param null $forceFee
1041
+     * @param string $feeStrategy
1042
+     * @param null|integer $forceFee
1039 1043
      * @return array
1040 1044
      */
1041 1045
     public function coinSelection($outputs, $lockUTXO = true, $allowZeroConf = false, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             $changeIdx = self::CHAIN_BCC_DEFAULT;
185 185
         }
186 186
 
187
-        $this->isSegwit = (bool) $segwit;
187
+        $this->isSegwit = (bool)$segwit;
188 188
         $this->chainIndex = $chainIdx;
189 189
         $this->changeIndex = $changeIdx;
190 190
         $this->walletPath = $this->getWalletPath(null);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @return array[]      [ [xpub, path] ]
234 234
      */
235 235
     public function getBlocktrailPublicKeys() {
236
-        return array_map(function (BIP32Key $key) {
236
+        return array_map(function(BIP32Key $key) {
237 237
             return $key->tuple();
238 238
         }, $this->blocktrailPublicKeys);
239 239
     }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     public function getAddressByPath($path) {
361 361
         $path = (string)BIP32Path::path($path)->privatePath();
362 362
         if (!isset($this->derivations[$path])) {
363
-            list($address, ) = $this->getRedeemScriptByPath($path);
363
+            list($address,) = $this->getRedeemScriptByPath($path);
364 364
 
365 365
             $this->derivations[$path] = $address;
366 366
             $this->derivationsByAddress[$address] = $path;
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
             $signInfo[] = $utxo->getSignInfo();
690 690
         }
691 691
 
692
-        $utxoSum = array_sum(array_map(function (UTXO $utxo) {
692
+        $utxoSum = array_sum(array_map(function(UTXO $utxo) {
693 693
             return $utxo->value;
694 694
         }, $utxos));
695 695
         if ($utxoSum < array_sum(array_column($send, 'value'))) {
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
             throw new \Exception("Wallet needs to be unlocked to pay");
823 823
         }
824 824
 
825
-        assert(Util::all(function ($signInfo) {
825
+        assert(Util::all(function($signInfo) {
826 826
             return $signInfo instanceof SignInfo;
827 827
         }, $signInfo), '$signInfo should be SignInfo[]');
828 828
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
         ];
836 836
 
837 837
         // send the transaction
838
-        return $this->sendTransaction($txs, array_map(function (SignInfo $r) {
838
+        return $this->sendTransaction($txs, array_map(function(SignInfo $r) {
839 839
             return (string)$r->path;
840 840
         }, $signInfo), $apiCheckFee);
841 841
     }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
     public static function estimateSizeUTXOs($utxoCnt) {
895 895
         $txinSize = 0;
896 896
 
897
-        for ($i=0; $i<$utxoCnt; $i++) {
897
+        for ($i = 0; $i < $utxoCnt; $i++) {
898 898
             // @TODO: proper size calculation, we only do multisig right now so it's hardcoded and then we guess the size ...
899 899
             $multisig = "2of3";
900 900
 
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
      * @return int
969 969
      */
970 970
     protected function determineChange($utxos, $outputs, $fee) {
971
-        $inputsTotal = array_sum(array_map(function (UTXO $utxo) {
971
+        $inputsTotal = array_sum(array_map(function(UTXO $utxo) {
972 972
             return $utxo->value;
973 973
         }, $utxos));
974 974
         $outputsTotal = array_sum(array_column($outputs, 'value'));
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     protected function signTransaction(Transaction $tx, array $signInfo) {
988 988
         $signer = new Signer($tx, Bitcoin::getEcAdapter());
989 989
 
990
-        assert(Util::all(function ($signInfo) {
990
+        assert(Util::all(function($signInfo) {
991 991
             return $signInfo instanceof SignInfo;
992 992
         }, $signInfo), '$signInfo should be SignInfo[]');
993 993
 
Please login to merge, or discard this patch.