| @@ 66-86 (lines=21) @@ | ||
| 63 | * @return array |
|
| 64 | * @throws \Exception |
|
| 65 | */ |
|
| 66 | protected function normalizeNetwork($network, $testnet) { |
|
| 67 | switch (strtolower($network)) { |
|
| 68 | case 'btc': |
|
| 69 | case 'bitcoin': |
|
| 70 | $network = 'bitcoin'; |
|
| 71 | ||
| 72 | break; |
|
| 73 | ||
| 74 | case 'tbtc': |
|
| 75 | case 'bitcoin-testnet': |
|
| 76 | $network = 'bitcoin'; |
|
| 77 | $testnet = true; |
|
| 78 | ||
| 79 | break; |
|
| 80 | ||
| 81 | default: |
|
| 82 | throw new \Exception("Unknown network [{$network}]"); |
|
| 83 | } |
|
| 84 | ||
| 85 | return [$network, $testnet]; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * set BitcoinLib to the correct magic-byte defaults for the selected network |
|
| @@ 128-148 (lines=21) @@ | ||
| 125 | * @return array |
|
| 126 | * @throws \Exception |
|
| 127 | */ |
|
| 128 | protected function normalizeNetwork($network, $testnet) { |
|
| 129 | switch (strtolower($network)) { |
|
| 130 | case 'btc': |
|
| 131 | case 'bitcoin': |
|
| 132 | $network = 'bitcoin'; |
|
| 133 | ||
| 134 | break; |
|
| 135 | ||
| 136 | case 'tbtc': |
|
| 137 | case 'bitcoin-testnet': |
|
| 138 | $network = 'bitcoin'; |
|
| 139 | $testnet = true; |
|
| 140 | ||
| 141 | break; |
|
| 142 | ||
| 143 | default: |
|
| 144 | throw new \Exception("Unknown network [{$network}]"); |
|
| 145 | } |
|
| 146 | ||
| 147 | return [$network, $testnet]; |
|
| 148 | } |
|
| 149 | ||
| 150 | ||
| 151 | /** |
|