Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 2 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Addresses_Generation_Result | |
0.00% |
0 / 2 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_highest_address_index | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Model class representing the result of generating new addresses for a wallet. |
| 4 | * |
| 5 | * @package brianhenryie/bh-wp-bitcoin-gateway |
| 6 | */ |
| 7 | |
| 8 | namespace BrianHenryIE\WP_Bitcoin_Gateway\API\Model\Results; |
| 9 | |
| 10 | use BrianHenryIE\WP_Bitcoin_Gateway\API\Model\Wallet\Bitcoin_Address; |
| 11 | use BrianHenryIE\WP_Bitcoin_Gateway\API\Model\Wallet\Bitcoin_Wallet; |
| 12 | |
| 13 | /** |
| 14 | * Addresses generation result model. |
| 15 | * |
| 16 | * @see API::generate_new_addresses() |
| 17 | * @see API_Interface::generate_new_addresses() |
| 18 | * |
| 19 | * @used-by Bitcoin_Wallet_Service::generate_new_addresses_for_wallet() |
| 20 | */ |
| 21 | readonly class Addresses_Generation_Result { |
| 22 | |
| 23 | /** |
| 24 | * Constructor |
| 25 | * |
| 26 | * @param Bitcoin_Wallet $wallet The wallet that the new addresses were generated for, refreshed. |
| 27 | * @param non-empty-array<Bitcoin_Address> $new_addresses The newly generated addresses. |
| 28 | * @param array<Bitcoin_Address> $orphaned_addresses Existing saved addresses with incorrect wallet post id. |
| 29 | * @param ?int $prior_address_index The new highest wallet address index. |
| 30 | */ |
| 31 | public function __construct( |
| 32 | public Bitcoin_Wallet $wallet, |
| 33 | public array $new_addresses, |
| 34 | public array $orphaned_addresses = array(), |
| 35 | public ?int $prior_address_index = null, |
| 36 | ) { |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get the index of the highest (known) derived address. |
| 41 | */ |
| 42 | public function get_highest_address_index(): ?int { |
| 43 | return $this->wallet->get_address_index(); |
| 44 | } |
| 45 | } |